Skip to content

Commit

Permalink
Merge pull request #459 from lsst/tickets/DM-39764
Browse files Browse the repository at this point in the history
DM-39764: Remove use of pkg_resources
  • Loading branch information
timj authored Jun 23, 2023
2 parents 0d68140 + b2e3860 commit e375ff5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions python/lsst/obs/base/instrument_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
from functools import lru_cache
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Sequence, Set

import pkg_resources
from lsst.daf.butler import CollectionType, DatasetType, Registry, RegistryConfig
from lsst.daf.butler.formatters.yaml import YamlFormatter
from lsst.obs.base import FilterDefinition, FilterDefinitionCollection, Instrument
from lsst.obs.base.yamlCamera import makeCamera
from lsst.resources import ResourcePath
from lsst.utils.introspection import get_full_type_name
from pydantic import BaseModel

Expand Down Expand Up @@ -122,8 +122,8 @@ def getObsDataPackageDir(cls) -> Optional[str]:
def getCamera(self):
# Return something that can be indexed by detector number
# but also has to support getIdIter.
filename = pkg_resources.resource_filename("lsst.obs.base", "test/dummycam.yaml")
return makeCamera(filename)
with ResourcePath("resource://lsst.obs.base/test/dummycam.yaml").as_local() as local_file:
return makeCamera(local_file.ospath)

def register(self, registry, update=False):
"""Insert Instrument, physical_filter, and detector entries into a
Expand Down
7 changes: 4 additions & 3 deletions tests/test_yamlCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@

import unittest

import pkg_resources
from lsst.obs.base.yamlCamera import makeCamera
from lsst.resources import ResourcePath


class YamlCameraTestCase(unittest.TestCase):
"""Test the YAML camera geometry."""

def setUp(self):
self.cameraFile = pkg_resources.resource_filename("lsst.obs.base", "test/dummycam.yaml")
self.cameraFile = ResourcePath("resource://lsst.obs.base/test/dummycam.yaml")

def test_basics(self):
"""Basic test of yaml camera construction"""
camera = makeCamera(self.cameraFile)
with self.cameraFile.as_local() as local_file:
camera = makeCamera(local_file.ospath)

self.assertEqual(len(camera), 2)
self.assertEqual(camera[0].getName(), "RXX_S00")
Expand Down
1 change: 0 additions & 1 deletion types.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
types-requests
types-PyYAML
types-pkg_resources
types-Deprecated
types-python-dateutil

0 comments on commit e375ff5

Please sign in to comment.