diff --git a/pyproject.toml b/pyproject.toml index cb5855b2..68751873 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,6 @@ ignore = [ "D100", "D200", "D205", - "D400", ] line-length = 110 select = [ @@ -76,6 +75,7 @@ select = [ "F", # pyflakes "N", # pep8-naming "W", # pycodestyle + "D", # pydocstyle ] target-version = "py310" extend-select = [ diff --git a/python/lsst/obs/base/_instrument.py b/python/lsst/obs/base/_instrument.py index 38bd345a..d23c1e5c 100644 --- a/python/lsst/obs/base/_instrument.py +++ b/python/lsst/obs/base/_instrument.py @@ -179,8 +179,8 @@ def getCamera(self) -> Camera: @classmethod @lru_cache def getObsDataPackageDir(cls) -> str | None: - """The root of the obs data package that provides specializations for - this instrument. + """Return the root of the obs data package that provide + specializations for this instrument. Returns ------- diff --git a/python/lsst/obs/base/_read_curated_calibs.py b/python/lsst/obs/base/_read_curated_calibs.py index b6e5016d..055acdf8 100644 --- a/python/lsst/obs/base/_read_curated_calibs.py +++ b/python/lsst/obs/base/_read_curated_calibs.py @@ -129,7 +129,7 @@ def check_metadata( filepath: str, data_name: str, ) -> None: - """Check that the metadata is complete and self consistent + """Check that the metadata is complete and self consistent. Parameters ---------- diff --git a/python/lsst/obs/base/butler_tests.py b/python/lsst/obs/base/butler_tests.py index c74d56bb..7e6ae359 100644 --- a/python/lsst/obs/base/butler_tests.py +++ b/python/lsst/obs/base/butler_tests.py @@ -226,7 +226,7 @@ def test_get_linearizer(self): linearizer.checkDetector(detector) def test_get_linearizer_bad_detectorIds(self): - """Do bad detectorIds raise?""" + """Check that bad detectorIds raise.""" if self.butler_get_data.linearizer_type is unittest.SkipTest: self.skipTest("Skipping %s as requested" % (inspect.currentframe().f_code.co_name)) diff --git a/python/lsst/obs/base/camera_tests.py b/python/lsst/obs/base/camera_tests.py index f56b97e3..fe38d5ca 100644 --- a/python/lsst/obs/base/camera_tests.py +++ b/python/lsst/obs/base/camera_tests.py @@ -84,9 +84,7 @@ def _butler_args(self): return kwargs def test_iterable(self): - """Simplest camera test: can we get a Camera instance, and does - iterating return Detectors? - """ + """Get a camera instance and check it is an iterable.""" camera = self.butler.get("camera", **self._butler_args()) self.assertIsInstance(camera, lsst.afw.cameraGeom.Camera) for detector in camera: @@ -101,7 +99,7 @@ def test_camera_butler(self): self.assertEqual(next(iter(camera)).getName(), self.camera_data.first_detector_name) def test_plate_scale(self): - """Check the plate scale at center of focal plane + """Check the plate scale at center of focal plane. Check plate_scale using the FOCAL_PLANE to FIELD_ANGLE transform from the camera. diff --git a/python/lsst/obs/base/cli/cmd/commands.py b/python/lsst/obs/base/cli/cmd/commands.py index fa2cbd47..721a8af5 100644 --- a/python/lsst/obs/base/cli/cmd/commands.py +++ b/python/lsst/obs/base/cli/cmd/commands.py @@ -154,7 +154,7 @@ def define_visits(*args, **kwargs): @failfast_option() @options_file_option() def ingest_raws(*args, **kwargs): - """Ingest raw frames into from a directory into the butler registry""" + """Ingest raw frames into from a directory into the butler registry.""" script.ingestRaws(*args, **kwargs) diff --git a/python/lsst/obs/base/cli/doc/butlerCmdDocGen.py b/python/lsst/obs/base/cli/doc/butlerCmdDocGen.py index d3bf7f16..82f783cc 100644 --- a/python/lsst/obs/base/cli/doc/butlerCmdDocGen.py +++ b/python/lsst/obs/base/cli/doc/butlerCmdDocGen.py @@ -30,6 +30,8 @@ class ButlerCmdDocGen(click.MultiCommand): + """Provide access of butler subcommand plugins to Sphinx.""" + def list_commands(self, ctx): """List the click commands provided by this package. @@ -65,4 +67,5 @@ def get_command(self, context, name): @click.command(cls=ButlerCmdDocGen) def cli(): + """Run the command.""" pass diff --git a/python/lsst/obs/base/defineVisits.py b/python/lsst/obs/base/defineVisits.py index d4ff56e1..40efa7f7 100644 --- a/python/lsst/obs/base/defineVisits.py +++ b/python/lsst/obs/base/defineVisits.py @@ -168,7 +168,7 @@ class _VisitRecords: class GroupExposuresConfig(Config): - pass + """Configure exposure grouping.""" class GroupExposuresTask(Task, metaclass=ABCMeta): @@ -276,6 +276,8 @@ def getVisitSystems(self) -> set[VisitSystem]: class ComputeVisitRegionsConfig(Config): + """Configure visit region calculations.""" + padding: Field[int] = Field( dtype=int, default=250, @@ -373,6 +375,8 @@ def compute( class DefineVisitsConfig(Config): + """Configure visit definition.""" + groupExposures = GroupExposuresTask.registry.makeField( doc="Algorithm for grouping exposures into visits.", default="one-to-one-and-by-counter", diff --git a/python/lsst/obs/base/exposureAssembler.py b/python/lsst/obs/base/exposureAssembler.py index b75d4932..b20dbcdf 100644 --- a/python/lsst/obs/base/exposureAssembler.py +++ b/python/lsst/obs/base/exposureAssembler.py @@ -34,6 +34,10 @@ class ExposureAssembler(StorageClassDelegate): + """Knowledge of how to assemble and disassemble an + `~lsst.afw.image.Exposure`. + """ + EXPOSURE_COMPONENTS = {"image", "variance", "mask", "wcs", "psf"} EXPOSURE_INFO_COMPONENTS = { "apCorrMap", @@ -85,7 +89,7 @@ def _groupRequestedComponents(self) -> tuple[set[str], set[str]]: return expItems, expInfoItems def getComponent(self, composite: lsst.afw.image.Exposure, componentName: str) -> Any: - """Get a component from an Exposure + """Get a component from an Exposure. Parameters ---------- diff --git a/python/lsst/obs/base/exposureIdInfo.py b/python/lsst/obs/base/exposureIdInfo.py index 1ab484df..fcc1bb27 100644 --- a/python/lsst/obs/base/exposureIdInfo.py +++ b/python/lsst/obs/base/exposureIdInfo.py @@ -86,7 +86,7 @@ class ExposureIdInfo: """ def __init__(self, expId: int = 0, expBits: int = 1, maxBits: int | None = None): - """Construct an ExposureIdInfo + """Construct an ExposureIdInfo. See the class doc string for an explanation of the arguments. """ diff --git a/python/lsst/obs/base/formatters/fitsExposure.py b/python/lsst/obs/base/formatters/fitsExposure.py index 0e568b19..3b271688 100644 --- a/python/lsst/obs/base/formatters/fitsExposure.py +++ b/python/lsst/obs/base/formatters/fitsExposure.py @@ -358,7 +358,7 @@ def validateWriteRecipes(cls, recipes): return recipes def checkUnrecognized(entry, allowed, description): - """Check to see if the entry contains unrecognised keywords""" + """Check to see if the entry contains unrecognised keywords.""" unrecognized = set(entry) - set(allowed) if unrecognized: raise RuntimeError( @@ -426,7 +426,7 @@ def readComponent(self, component): def standardizeAmplifierParameters(parameters, on_disk_detector): - """Preprocess the Exposure storage class's "amp" and "detector" parameters + """Preprocess the Exposure storage class's "amp" and "detector" parameters. This checks the given objects for consistency with the on-disk geometry and converts amplifier IDs/names to Amplifier instances. diff --git a/python/lsst/obs/base/ingest.py b/python/lsst/obs/base/ingest.py index dc79a76c..4c81ea45 100644 --- a/python/lsst/obs/base/ingest.py +++ b/python/lsst/obs/base/ingest.py @@ -461,7 +461,8 @@ def extractMetadata(self, filename: ResourcePath) -> RawFileData: @classmethod def getObservationInfoSubsets(cls) -> tuple[set, set]: - """Return subsets of fields in the `ObservationInfo` that we care about + """Return subsets of fields in the `ObservationInfo` that we care + about. These fields will be used in constructing an exposure record. @@ -797,7 +798,7 @@ def groupByExposure(self, files: Iterable[RawFileData]) -> list[RawExposureData] def makeExposureRecord( self, obsInfo: ObservationInfo, universe: DimensionUniverse, **kwargs: Any ) -> DimensionRecord: - """Construct a registry record for an exposure + """Construct a registry record for an exposure. This is a method that subclasses will often want to customize. This can often be done by calling this base class implementation with additional @@ -823,7 +824,7 @@ def makeExposureRecord( def makeDependencyRecords( self, obsInfo: ObservationInfo, universe: DimensionUniverse ) -> dict[str, DimensionRecord]: - """Construct dependency records + """Construct dependency records. These dependency records will be inserted into the `~lsst.daf.butler.Registry` before the exposure records, because they diff --git a/python/lsst/obs/base/instrument_tests.py b/python/lsst/obs/base/instrument_tests.py index 757b11d1..cd2b671f 100644 --- a/python/lsst/obs/base/instrument_tests.py +++ b/python/lsst/obs/base/instrument_tests.py @@ -101,6 +101,8 @@ def getMetadata(self) -> dict[str, Any]: class DummyCam(Instrument): + """Instrument class used for testing.""" + filterDefinitions = DUMMY_FILTER_DEFINITIONS additionalCuratedDatasetTypes = frozenset(["testCalib"]) policyName = "dummycam" diff --git a/python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py b/python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py index a8eace6a..9308dbf6 100755 --- a/python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py +++ b/python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py @@ -105,7 +105,7 @@ def __call__(self, md): @staticmethod def observationInfo2visitInfo(obsInfo, log=None): """Construct a `~lsst.afw.image.VisitInfo` from an - `~astro_metadata_translator.ObservationInfo` + `~astro_metadata_translator.ObservationInfo`. Parameters ---------- diff --git a/python/lsst/obs/base/script/defineVisits.py b/python/lsst/obs/base/script/defineVisits.py index c8d64438..eb0f8e06 100644 --- a/python/lsst/obs/base/script/defineVisits.py +++ b/python/lsst/obs/base/script/defineVisits.py @@ -37,7 +37,7 @@ def defineVisits( incremental=False, raw_name="raw", ): - """Implements the command line interface `butler define-visits` subcommand, + """Implement the command line interface `butler define-visits` subcommand, should only be called by command line tools and unit test code that tests this function. diff --git a/python/lsst/obs/base/script/ingestRaws.py b/python/lsst/obs/base/script/ingestRaws.py index 3cc31ac6..8e70c7c0 100644 --- a/python/lsst/obs/base/script/ingestRaws.py +++ b/python/lsst/obs/base/script/ingestRaws.py @@ -37,7 +37,7 @@ def ingestRaws( ingest_task="lsst.obs.base.RawIngestTask", track_file_attrs=True, ): - """Ingests raw frames into the butler registry + """Ingests raw frames into the butler registry. Parameters ---------- diff --git a/python/lsst/obs/base/utils.py b/python/lsst/obs/base/utils.py index 157d702c..b7b30ab3 100644 --- a/python/lsst/obs/base/utils.py +++ b/python/lsst/obs/base/utils.py @@ -116,7 +116,7 @@ def createInitialSkyWcsFromBoresight(boresight, orientation, detector, flipX=Fal def bboxFromIraf(irafBBoxStr): - """Return a Box2I corresponding to an IRAF-style BBOX + """Return a Box2I corresponding to an IRAF-style BBOX. [x0:x1,y0:y1] where x0 and x1 are the one-indexed start and end columns, and correspondingly y0 and y1 are the start and end rows. diff --git a/python/lsst/obs/base/yamlCamera.py b/python/lsst/obs/base/yamlCamera.py index b16c4dfb..925ed1af 100755 --- a/python/lsst/obs/base/yamlCamera.py +++ b/python/lsst/obs/base/yamlCamera.py @@ -33,7 +33,7 @@ @lru_cache def makeCamera(cameraFile): - """An imaging camera (e.g. the LSST 3Gpix camera) + """Construct an imaging camera (e.g. the LSST 3Gpix camera). Parameters ---------- @@ -68,7 +68,7 @@ def makeCamera(cameraFile): def makeDetectorConfigList(ccdParams): - """Make a list of detector configs + """Make a list of detector configs. Returns ------- @@ -111,7 +111,7 @@ def makeDetectorConfigList(ccdParams): def makeAmplifierList(ccd): - """Construct a list of AmplifierBuilder objects""" + """Construct a list of AmplifierBuilder objects.""" # Much of this will need to be filled in when we know it. assert len(ccd) > 0 amp = list(ccd["amplifiers"].values())[0] @@ -198,7 +198,7 @@ def makeAmpInfoCatalog(ccd): def makeBBoxFromList(ylist): """Given a list [(x0, y0), (xsize, ysize)], probably from a yaml file, - return a BoxI + return a BoxI. """ (x0, y0), (xsize, ysize) = ylist return geom.BoxI(geom.PointI(x0, y0), geom.ExtentI(xsize, ysize)) @@ -206,7 +206,7 @@ def makeBBoxFromList(ylist): def makeTransformDict(nativeSys, transformDict, plateScale): """Make a dictionary of TransformPoint2ToPoint2s from yaml, mapping from - nativeSys + nativeSys. Parameters ---------- @@ -276,7 +276,7 @@ def makeCameraFromCatalogs( pupilFactoryClass=cameraGeom.pupil.PupilFactory, ): """Construct a Camera instance from a dictionary of - detector name : `lsst.afw.cameraGeom.amplifier` + detector name and `lsst.afw.cameraGeom.amplifier`. Parameters ---------- @@ -290,12 +290,11 @@ def makeCameraFromCatalogs( transformDict : `dict` A dict of lsst.afw.cameraGeom.CameraSys : `lsst.afw.geom.TransformPoint2ToPoint2` - amplifierDict : `dict` - A dictionary of detector name : - `lsst.afw.cameraGeom.Amplifier.Builder` - pupilFactoryClass : `type`, optional - Class to attach to camera; - `lsst.default afw.cameraGeom.PupilFactory` + amplifierDict : `dict` [`str`, `lsst.afw.cameraGeom.Amplifier.Builder` ] + A dictionary of detector name and amplifier builders. + pupilFactoryClass : `type` [ `lsst.default afw.cameraGeom.PupilFactory`], \ + optional + Class to attach to camera. Returns ------- diff --git a/tests/test_butlerFits.py b/tests/test_butlerFits.py index bdf1662d..03d375a8 100644 --- a/tests/test_butlerFits.py +++ b/tests/test_butlerFits.py @@ -100,6 +100,8 @@ class ButlerFitsTests(lsst.utils.tests.TestCase): + """Tests for butler interaction with FITS files.""" + @classmethod def setUpClass(cls): """Create a new butler once only.""" @@ -214,7 +216,7 @@ def testFundamentalTypes(self) -> None: self.runFundamentalTypeTest("pl", pl) def testFitsCatalog(self) -> None: - """Test reading of a FITS catalog""" + """Test reading of a FITS catalog.""" catalog = self.makeExampleCatalog() dataId = {"visit": 42, "instrument": "DummyCam", "physical_filter": "d-r"} ref = self.butler.put(catalog, "testCatalog", dataId) @@ -227,14 +229,14 @@ def testFitsCatalog(self) -> None: self.assertEqual(len(astropy_table), len(stored)) def testExposureCompositePutGetConcrete(self) -> None: - """Test composite with no disassembly""" + """Test composite with no disassembly.""" ref = self.runExposureCompositePutGetTest("calexp") uri = self.butler.getURI(ref) self.assertTrue(uri.exists(), f"Checking URI {uri} existence") def testExposureCompositePutGetVirtual(self) -> None: - """Testing composite disassembly""" + """Testing composite disassembly.""" ref = self.runExposureCompositePutGetTest("unknown") primary, components = self.butler.getURIs(ref) diff --git a/tests/test_cliCmdDefineVisits.py b/tests/test_cliCmdDefineVisits.py index 25a7edb4..628205bf 100644 --- a/tests/test_cliCmdDefineVisits.py +++ b/tests/test_cliCmdDefineVisits.py @@ -29,6 +29,8 @@ class DefineVisitsTest(CliCmdTestBase, unittest.TestCase): + """Test the define-visits command-line tool.""" + mockFuncName = "lsst.obs.base.cli.cmd.commands.script.defineVisits" @staticmethod @@ -82,7 +84,7 @@ def test_all(self): ) def test_missing(self): - """Test a missing argument""" + """Test a missing argument.""" self.run_missing(["define-visits"], "Missing argument ['\"]REPO['\"]") self.run_missing(["define-visits", "here"], "Missing argument ['\"]INSTRUMENT['\"]") diff --git a/tests/test_cliCmdTestIngest.py b/tests/test_cliCmdTestIngest.py index ffe5a692..f0ddcde1 100644 --- a/tests/test_cliCmdTestIngest.py +++ b/tests/test_cliCmdTestIngest.py @@ -35,6 +35,8 @@ class IngestRawsTestCase(CliCmdTestBase, unittest.TestCase): + """Test the ingest-raws command-line tool.""" + mockFuncName = "lsst.obs.base.cli.cmd.commands.script.ingestRaws" @staticmethod @@ -57,14 +59,14 @@ def command(): return ingest_raws def test_repoAndOutput(self): - """Test the most basic required arguments, repo and output run""" + """Test the most basic required arguments, repo and output run.""" self.run_test( ["ingest-raws", "repo", "resources", "--output-run", "out"], self.makeExpected(repo="repo", locations=("resources",), output_run="out"), ) def test_configMulti(self): - """Test config overrides""" + """Test config overrides.""" self.run_test( [ "ingest-raws", @@ -88,7 +90,7 @@ def test_configMulti(self): ) def test_configFile(self): - """Test config file override""" + """Test config file override.""" configFile = "path/to/file.txt" self.run_test( ["ingest-raws", "repo", "resources", "--output-run", "out", "--config-file", configFile], @@ -99,14 +101,14 @@ def test_configFile(self): ) def test_transfer(self): - """Test the transfer argument""" + """Test the transfer argument.""" self.run_test( ["ingest-raws", "repo", "resources", "--output-run", "out", "--transfer", "symlink"], self.makeExpected(repo="repo", locations=("resources",), output_run="out", transfer="symlink"), ) def test_ingestTask(self): - """Test the ingest task argument""" + """Test the ingest task argument.""" self.run_test( ["ingest-raws", "repo", "resources", "--output-run", "out", "--ingest-task", "foo.bar.baz"], self.makeExpected( @@ -125,6 +127,8 @@ def test_locations(self): class PatchRawIngestTask(lsst.obs.base.RawIngestTask): + """Ingest task with run() method disabled.""" + init_args = [] def __init__(self, *args, **kwargs): @@ -136,6 +140,8 @@ def run(self, *args, **kwargs): class RawIngestMockTest(unittest.TestCase): + """Run ingest tests with mock.""" + def setUp(self): self.runner = LogCliRunner() diff --git a/tests/test_cliCmdWriteCuratedCalibrations.py b/tests/test_cliCmdWriteCuratedCalibrations.py index 368eadb4..a8d41520 100644 --- a/tests/test_cliCmdWriteCuratedCalibrations.py +++ b/tests/test_cliCmdWriteCuratedCalibrations.py @@ -29,6 +29,8 @@ class WriteCuratedCalibrationsTest(CliCmdTestBase, unittest.TestCase): + """Test write-curated-calibrations command-line tool.""" + mockFuncName = "lsst.obs.base.cli.cmd.commands.script.writeCuratedCalibrations" @staticmethod @@ -47,7 +49,7 @@ def test_repoBasic(self): ) def test_missing(self): - """Test a missing argument""" + """Test a missing argument.""" self.run_missing(["write-curated-calibrations"], "Missing argument ['\"]REPO['\"]") self.run_missing(["write-curated-calibrations", "here"], "Missing argument ['\"]INSTRUMENT['\"]") diff --git a/tests/test_cliLog.py b/tests/test_cliLog.py index dfdc8568..53cb90f9 100644 --- a/tests/test_cliLog.py +++ b/tests/test_cliLog.py @@ -49,6 +49,8 @@ class CliLogTestCase(CliLogTestBase, unittest.TestCase): @unittest.skipIf(lsstLog is None, "lsst.log is not available.") class ConvertLsstLogLevelTestCase(unittest.TestCase): + """Test ability to handle lsst.log loggers.""" + def test_convertToLsstLogLevel(self): """Test that the log levels accepted by the log_level_option are translated to lsst.log levels correctly. diff --git a/tests/test_defineVisits.py b/tests/test_defineVisits.py index 967206e0..3718710e 100644 --- a/tests/test_defineVisits.py +++ b/tests/test_defineVisits.py @@ -37,6 +37,8 @@ class DefineVisitsTestCase(unittest.TestCase): + """Test visit definition.""" + def setUp(self): """Create a new butler for each test since we are changing dimension records. diff --git a/tests/test_filters.py b/tests/test_filters.py index d6c785c5..b30c7f16 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -28,6 +28,8 @@ class TestFilterDefinitionCollection(lsst.utils.tests.TestCase): + """Test filter definition collection.""" + def setUp(self): self.filters1 = FilterDefinitionCollection( FilterDefinition(physical_filter="abc"), @@ -54,6 +56,8 @@ def test_physical_to_band(self): class TestFilterDefinition(lsst.utils.tests.TestCase): + """Test filter definition.""" + def setUp(self): self.filter_g = FilterDefinition(band="g", physical_filter="HSC-G", alias={"ABCDEFG"}) self.filter_g2 = FilterDefinition(band="g", physical_filter="HSC-G2", afw_name="g2", alias={"HIJK"}) @@ -81,10 +85,11 @@ def test_abstract_only(self): class MemoryTester(lsst.utils.tests.MemoryTestCase): - pass + """Check for file leaks.""" def setup_module(module): + """Initialize pytest.""" lsst.utils.tests.init() diff --git a/tests/test_fitsRawFormatter.py b/tests/test_fitsRawFormatter.py index 4948bfa5..c1c7e7b4 100644 --- a/tests/test_fitsRawFormatter.py +++ b/tests/test_fitsRawFormatter.py @@ -45,6 +45,10 @@ class SimpleTestingTranslator(FitsTranslator, StubTranslator): + """Simple `~astro_metadata_translator.MetadataTranslator` used for + testing. + """ + _const_map = { "boresight_rotation_angle": Angle(90 * u.deg), "boresight_rotation_coord": "sky", @@ -78,10 +82,14 @@ def to_tracking_radec(self): class MakeTestingRawVisitInfo(MakeRawVisitInfoViaObsInfo): + """Test class for VisitInfo creation.""" + metadataTranslator = SimpleTestingTranslator class SimpleFitsRawFormatter(FitsRawFormatterBase): + """Simple test formatter for datastore interaction,.""" + filterDefinitions = FilterDefinitionCollection(FilterDefinition(physical_filter="u", band="u")) @property @@ -100,6 +108,8 @@ def getDetector(self, id): class FitsRawFormatterTestCase(lsst.utils.tests.TestCase): + """Test that we can read and write FITS files with butler.""" + def setUp(self): # The FITS WCS and VisitInfo coordinates in this header are # intentionally different, to make comparisons between them more @@ -234,10 +244,11 @@ def test_amp_parameter(self): class MemoryTester(lsst.utils.tests.MemoryTestCase): - pass + """Check for file leaks.""" def setup_module(module): + """Initialize pytest.""" lsst.utils.tests.init() diff --git a/tests/test_instrument.py b/tests/test_instrument.py index 56fcef87..d37866b1 100644 --- a/tests/test_instrument.py +++ b/tests/test_instrument.py @@ -39,7 +39,7 @@ class InstrumentTestCase(InstrumentTests, unittest.TestCase): ) def test_getCamera(self): - """No camera defined in DummyCam""" + """No camera defined in DummyCam.""" return def test_collectionTimestamps(self): diff --git a/tests/test_makeRawVisitInfoViaObsInfo.py b/tests/test_makeRawVisitInfoViaObsInfo.py index 783bed95..634c5bce 100644 --- a/tests/test_makeRawVisitInfoViaObsInfo.py +++ b/tests/test_makeRawVisitInfoViaObsInfo.py @@ -31,6 +31,8 @@ class NewTranslator(FitsTranslator, StubTranslator): + """Metadata translator to use for tests.""" + _trivial_map = { "exposure_time": "EXPTIME", "exposure_id": "EXP-ID", @@ -52,10 +54,14 @@ def to_focus_z(self): class MakeTestableVisitInfo(MakeRawVisitInfoViaObsInfo): + """Test class for VisitInfo construction.""" + metadataTranslator = NewTranslator class TestMakeRawVisitInfoViaObsInfo(unittest.TestCase): + """Test VisitInfo construction.""" + def setUp(self): # Reference values self.exposure_time = 6.2 * u.s diff --git a/tests/test_utils.py b/tests/test_utils.py index e2875502..889eff34 100755 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -27,7 +27,7 @@ class BboxFromIrafTestCase(lsst.utils.tests.TestCase): - """Demonstrate that we can correctly parse IRAF-style BBOXes""" + """Demonstrate that we can correctly parse IRAF-style BBOXes.""" def testValid(self): test_data = { @@ -48,10 +48,11 @@ def testInvalid(self): class MemoryTester(lsst.utils.tests.MemoryTestCase): - pass + """Test for file leaks.""" def setup_module(module): + """Initialize pytest.""" lsst.utils.tests.init() diff --git a/tests/test_yamlCamera.py b/tests/test_yamlCamera.py index 6e62e5fc..78bca1c4 100644 --- a/tests/test_yamlCamera.py +++ b/tests/test_yamlCamera.py @@ -32,7 +32,7 @@ def setUp(self): self.cameraFile = ResourcePath("resource://lsst.obs.base/test/dummycam.yaml") def test_basics(self): - """Basic test of yaml camera construction""" + """Basic test of yaml camera construction.""" with self.cameraFile.as_local() as local_file: camera = makeCamera(local_file.ospath)