Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-11539

meas_base test_PluginLogs.py depends on global state

    Details

      Description

      test_PluginLogs.py fails if you run all the tests for meas_base in a single process (such as would happen if you type pytest in the build directory. I think this is because the test is relying on the set of registered plugins but that set has been modified by earlier tests.

      ============================================== FAILURES ==============================================
      __________________________ RegisteredPluginsTestCase.testSingleFramePlugins __________________________
       
      self = <test_PluginLogs.RegisteredPluginsTestCase testMethod=testSingleFramePlugins>
       
          def testSingleFramePlugins(self):
              center = lsst.afw.geom.Point2D(50, 50)
              bbox = lsst.afw.geom.Box2I(lsst.afw.geom.Point2I(0, 0),
                                              lsst.afw.geom.Extent2I(100,100))
              dataset = lsst.meas.base.tests.TestDataset(bbox)
              dataset.addSource(1000000.0, center)
              registry = SingleFramePlugin.registry
              dependencies = registry.keys()
      >       task = self.makeSingleFrameMeasurementTask("base_SdssCentroid", dependencies=dependencies)
       
      tests/test_PluginLogs.py:132: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      python/lsst/meas/base/tests.py:515: in makeSingleFrameMeasurementTask
          return SingleFrameMeasurementTask(schema=schema, algMetadata=algMetadata, config=config)
      python/lsst/meas/base/sfm.py:267: in __init__
          self.initializePlugins(schema=self.schema)
      python/lsst/meas/base/baseMeasurement.py:232: in initializePlugins
          for executionOrder, name, config, PluginClass in sorted(self.config.plugins.apply()):
      ../../stack/DarwinX86/pex_config/13.0-3-g520d906/python/lsst/pex/config/registry.py:182: in apply
          retvals.append(self._field.typemap.registry[c](*args, config=self[c], **kw))
      python/lsst/meas/base/pluginRegistry.py:95: in __call__
          return (self.PluginClass.getExecutionOrder(), self.name, config, self.PluginClass)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       
      cls = <class 'test_ApCorrNameSet.ApCorrNameTestCase.testRegisterDecorator.<locals>.NonApCorrPlugin'>
       
          @classmethod
          def getExecutionOrder(cls):
              """Sets the relative order of plugins (smaller numbers run first).
          
                  In general, the following class constants should be used (other values
                  are also allowed, but should be avoided unless they are needed):
                  CENTROID_ORDER      centroids and other algorithms that require only a Footprint
                                      and its Peaks as input
                  SHAPE_ORDER         shape measurements and other algorithms that require getCentroid() to return
                                      a good centroid (in addition to a Footprint and its Peaks).
                  FLUX_ORDER          flux algorithms that require both getShape() and getCentroid(),
                                      in addition to a Footprint and its Peaks
                  DEFAULT_CATALOGCALCULATION plugins that only operate on the catalog
          
                  Must be reimplemented as a class method by concrete derived classes.
          
                  This approach was chosen instead of a full graph-based analysis of dependencies
                  because algorithm dependencies are usually both quite simple and entirely substitutable:
                  an algorithm that requires a centroid can typically make use of any centroid algorithms
                  outputs.  That makes it relatively easy to figure out the correct value to use for any
                  particular algorithm.
                  """
      >       raise NotImplementedError("All plugins must implement getExecutionOrder()")
      E       NotImplementedError: All plugins must implement getExecutionOrder()
       
      python/lsst/meas/base/pluginsBase.py:78: NotImplementedError
      =============================== 1 failed, 197 passed in 72.78 seconds ================================
      

      If I reverse the order of tests all tests pass (but "P" is late in the alphabet so there are only ten or so tests after it).

        Attachments

          Container Issues

            Activity

              People

              • Assignee:
                tjenness Tim Jenness
                Reporter:
                tjenness Tim Jenness
                Reviewers:
                John Swinbank
                Watchers:
                Jim Bosch, John Swinbank, Kian-Tat Lim, Perry Gee, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel