Closed kmilo9999 closed 1 week ago
@gtdang @ntolley @jasmainak @dylansdaniels I found two problems that are making the tests fail in python 3.11+:
hnn_core/tests/test_drives.py
The code is looking to raise a ValueError
exception and match the error message against a specific string:
with pytest.raises(ValueError,
match=r'Burst duration (?s).* cannot be greater than'):
It seems that the regex rules changed in python 3.11+. It is enforced that global flags like (?s)
need to be placed at the begging of the pattern. Moving the flag to the indicated position fixes the test case.
hnn_core/tests/test_extracellular.py
Similar to the fist point, The code is looking to raise an AttributeError
exception and match the error message against a specific string:
with pytest.raises(AttributeError, match="can't set attribute"):
rec_arr.times = [1, 2, 3]
In this case, pythom 3.11+ changed the message of the AttributeError
exception to "property X of object Y has no setter"
, thus the test fails matching the two strings. I couldnt find this change in the python changelog, but I found the PR that applied it.
Looking forwards for your comments.
I'm not a regular expression expert but I trust your judgement. Can you run the CIs so I can see that they get fixed?
I'm not a regular expression expert but I trust your judgement. Can you run the CIs so I can see that they get fixed?
Do you mean the CI in the master branch? or in this PR?
@ntolley @gtdang It seems the unit tests are working now for python 3.11 and 3.12
@ntolley The branch protections need to be updated for the versions we are testing. It's still looking for 3.9, which is no longer in the matrix. 3.11 and 3.12 should be added.
All set! Thanks @kmilo9999 we're all breathing much easier with the return of the green checkmarks :smile:
✅ 🥳 ✅ 🥳 ✅
For now we decided to test the 2 latest versions and oldest supported version of python on mac, Linux, and windows for all PRs. A full-matrix test of all supported python versions performed at a longer frequency is still being considered.
This PR is aimed to fix incompatibilities found in the tests against python 3.11 and 3.12