qiskit-community / qiskit-algorithms

A library of quantum algorithms for Qiskit.
https://qiskit-community.github.io/qiskit-algorithms/
Apache License 2.0
111 stars 54 forks source link

CI unit testing has failures under 3.12.1 #113

Closed woodsp-ibm closed 7 months ago

woodsp-ibm commented 9 months ago

The nightly CI runs have been failing for the last few nights under Python 3.12 - mainly Ubuntu but it did do it with Mac too (Windows has no 3.12 runs yet - see #108)

E.g. https://github.com/qiskit-community/qiskit-algorithms/actions/runs/7256311824/job/19768394836

  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/stestr/subunit_runner/program.py", line 247, in runTests
    self.result = testRunner.run(self.test)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/stestr/subunit_runner/run.py", line 51, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 122, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 122, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/suite.py", line 122, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/case.py", line 692, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/case.py", line 662, in run
    result.stopTest(self)
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/subunit/test_results.py", line 127, in stopTest
    return self.super.stopTest(test)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/subunit/test_results.py", line 56, in stopTest
    return self.decorated.stopTest(test)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/testtools/testresult/real.py", line 1539, in stopTest
    self._tags = self._tags.parent
                 ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'parent'

And there are numerous warnings about a lack of addDuration in test result e.g.

/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/unittest/case.py:580: RuntimeWarning: TestResult has no addDuration method
  warnings.warn("TestResult has no addDuration method",

A similar issue is noted here too

mtreinish commented 9 months ago

I think this will be fixed by: https://github.com/testing-cabal/testtools/pull/371

woodsp-ibm commented 8 months ago

118 temporarily uses Python 3.12.0 where CI is running unit tests in order to avoid the issue for now. The changes there should be reverted once testtools has been updated/released with the fix linked above.

Update: As Qiskit Aer now supports 3.12 I was able to bump the CI job for max version from 3.11 in #130, but due to this also used specific version 3.12.0. So that aspect of the workflow should be updated too assuming #130 is merged ahead of being able to use just 3.12 and hence allow bug fix releases to be used as they appear.