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

verify fails on master, possibly with unexpected Quantity repr

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: verify
    • Labels:
      None

      Description

      In building verify package on my Mac with numpy 1.14.2 and astropy3 I get the following failure:

      ============================= test session starts ==============================
      platform darwin -- Python 3.6.3, pytest-3.2.0, py-1.4.34, pluggy-0.4.0
      rootdir: /Users/timj/work/lsstsw3/build/verify, inifile: setup.cfg
      plugins: session2file-0.1.9, forked-0.2, xdist-1.20.1, flake8-0.9.1, remotedata-0.2.1, openfiles-0.3.0, doctestplus-0.1.3, arraydiff-0.2
      collected 539 items 
      run-last-failure: rerun previous 2 failures
       
      tests/test_threshold_specification.py FF
       
       generated xml file: /Users/timj/work/lsstsw3/build/verify/tests/.tests/pytest-verify.xml 
      =================================== FAILURES ===================================
      ___________________ ThresholdSpecificationTestCase.test_spec ___________________
       
      self = <test_threshold_specification.ThresholdSpecificationTestCase testMethod=test_spec>
       
          def test_spec(self):
              """Test creating and accessing a specification from a quantity."""
              s = ThresholdSpecification('design', 5 * u.mag, '<')
              self.assertEqual(s.name, Name(spec='design'))
              self.assertEqual(s.type, 'threshold')
              self.assertEqual(s.threshold.value, 5.)
              self.assertEqual(s.threshold.unit, u.mag)
              self.assertEqual(s.operator_str, '<')
              self.assertEqual(
                  repr(s),
      >           "ThresholdSpecification("
                  "Name(spec='design'), <Quantity 5.0 mag>, '<')")
      E       AssertionError: "ThresholdSpecification(Name(spec='design'), <Quantity 5. mag>, '<')" != "ThresholdSpecification(Name(spec='design'), <Quantity 5.0 mag>, '<')"
      E       - ThresholdSpecification(Name(spec='design'), <Quantity 5. mag>, '<')
      E       + ThresholdSpecification(Name(spec='design'), <Quantity 5.0 mag>, '<')
      E       ?                                                         +
       
      tests/test_threshold_specification.py:118: AssertionError
      ___________________ ThresholdSpecificationTestCase.test_spec ___________________
       
      self = <test_threshold_specification.ThresholdSpecificationTestCase testMethod=test_spec>
       
          def test_spec(self):
              """Test creating and accessing a specification from a quantity."""
              s = ThresholdSpecification('design', 5 * u.mag, '<')
              self.assertEqual(s.name, Name(spec='design'))
              self.assertEqual(s.type, 'threshold')
              self.assertEqual(s.threshold.value, 5.)
              self.assertEqual(s.threshold.unit, u.mag)
              self.assertEqual(s.operator_str, '<')
              self.assertEqual(
                  repr(s),
      >           "ThresholdSpecification("
                  "Name(spec='design'), <Quantity 5.0 mag>, '<')")
      E       AssertionError: "ThresholdSpecification(Name(spec='design'), <Quantity 5. mag>, '<')" != "ThresholdSpecification(Name(spec='design'), <Quantity 5.0 mag>, '<')"
      E       - ThresholdSpecification(Name(spec='design'), <Quantity 5. mag>, '<')
      E       + ThresholdSpecification(Name(spec='design'), <Quantity 5.0 mag>, '<')
      E       ?                                                         +
       
      tests/test_threshold_specification.py:118: AssertionError
      ============================= 537 tests deselected =============================
      =================== 2 failed, 537 deselected in 3.40 seconds ===================
      Global pytest run: failed
      scons: Nothing to be done for `examples'.
      scons: Nothing to be done for `doc'.
      Failed test output:
      Global pytest output is in /Users/timj/work/lsstsw3/build/verify/tests/.tests/pytest-verify.xml.failed
      The following tests failed:
      /Users/timj/work/lsstsw3/build/verify/tests/.tests/pytest-verify.xml.failed
      1 tests failed
      scons: *** [checkTestStatus] Error 1
      scons: building terminated because of errors.
      

        Attachments

          Activity

          Hide
          jsick Jonathan Sick added a comment - - edited

          The repr for a Quantity must have changed.

          The code is https://github.com/lsst/verify/blob/master/python/lsst/verify/spec/threshold.py#L105

          Likely the best solution is just updating the test.

          Show
          jsick Jonathan Sick added a comment - - edited The repr for a Quantity must have changed. The code is https://github.com/lsst/verify/blob/master/python/lsst/verify/spec/threshold.py#L105 Likely the best solution is just updating the test.
          Hide
          rowen Russell Owen added a comment -

          Consider making the test more robust by being less picky about the representation, e.g. use a regex or a few "substr in fullstr" type tests to make sure the bits you care about are present.

          Show
          rowen Russell Owen added a comment - Consider making the test more robust by being less picky about the representation, e.g. use a regex or a few "substr in fullstr" type tests to make sure the bits you care about are present.
          Hide
          jsick Jonathan Sick added a comment -
          Show
          jsick Jonathan Sick added a comment - Good idea Russell Owen . Also, I've confirmed this isn't a breakage (yet) in CI: https://ci.lsst.codes/blue/organizations/jenkins/stack-os-matrix/detail/stack-os-matrix/27900/pipeline/46
          Hide
          tjenness Tim Jenness added a comment -

          If it's an astropy issue, I got the failure with astropy 2.0.3 (Jenkins is using 2.0.1) and 3.0.2.

          Show
          tjenness Tim Jenness added a comment - If it's an astropy issue, I got the failure with astropy 2.0.3 (Jenkins is using 2.0.1) and 3.0.2.
          Hide
          jsick Jonathan Sick added a comment -

          I can't reproduce with astropy upgraded all the way to 3.0.2, nor with numpy upgraded to 1.13. Conda isn't offering an upgrade to 1.14 for me, so I can only conclude it's numpy 1.14. I'll implement Russell's suggestion to change the repr tests, though.

          Show
          jsick Jonathan Sick added a comment - I can't reproduce with astropy upgraded all the way to 3.0.2, nor with numpy upgraded to 1.13. Conda isn't offering an upgrade to 1.14 for me, so I can only conclude it's numpy 1.14. I'll implement Russell's suggestion to change the repr tests, though.
          Hide
          jsick Jonathan Sick added a comment -

          Could you check if this PR builds in your env, Tim Jenness?

          Show
          jsick Jonathan Sick added a comment - Could you check if this PR builds in your env, Tim Jenness ?
          Hide
          tjenness Tim Jenness added a comment -

          Passes for me.

          Show
          tjenness Tim Jenness added a comment - Passes for me.

            People

            Assignee:
            jsick Jonathan Sick
            Reporter:
            tjenness Tim Jenness
            Reviewers:
            Tim Jenness
            Watchers:
            Jonathan Sick, Russell Owen, Tim Jenness
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.