pylink
pylink copied to clipboard
1.2.0: Some tests are incompatible with Python 3.12
Hi! :wave:
I package this project for Arch Linux. We are currently rebuilding against Python 3.12.
I noticed the following tests are now failing:
=========================== short test summary info ============================
FAILED tests/unit/test_jlink.py::TestJLink::test_cp15_register_write_success
FAILED tests/unit/test_jlink.py::TestJLink::test_jlink_restarted - AttributeE...
FAILED tests/unit/test_jlink.py::TestJLink::test_set_log_file_success - Attri...
FAILED tests/unit/test_library.py::TestLibrary::test_linux_dl_oserror - Attri...
FAILED tests/unit/test_library.py::TestLibrary::test_linux_dl_unavailable - A...
FAILED tests/unit/test_library.py::TestLibrary::test_linux_glibc_unavailable
======================== 6 failed, 436 passed in 1.13s =========================
python-pylink-square-1.2.0-2-x86_64-build.log python-pylink-square-1.2.0-2-x86_64-check.log
FTR: I am also applying https://github.com/square/pylink/pull/150 as we have removed mock from the repositories.
The test_library.py tests I can fix by replacing occurrences of assertEquals with assertEqual.
The other test failures seem harder to fix, maybe you have an idea?
I will ignore them for now
Looks like Python 3 changed these two things:
called_once_with -> assert_called_once_withassertEquals -> assertEqual
I think changing both should be fine; it looks like we use assert_called_once_with() in other places: https://github.com/square/pylink/blob/master/tests/unit/test_library.py#L437
Hi @hkpeprah, I maintain a NixOS package that depends on pylink and ran into the same issue as @dvzrv. I have opened a PR that I think resolves this, note that I did find 2 tests that appear to be broken.
Should be fixed in 1.2.1.