pylink icon indicating copy to clipboard operation
pylink copied to clipboard

1.2.0: Some tests are incompatible with Python 3.12

Open dvzrv opened this issue 1 year ago • 2 comments

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.

dvzrv avatar Apr 05 '24 20:04 dvzrv

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

dvzrv avatar Apr 05 '24 20:04 dvzrv

Looks like Python 3 changed these two things:

  • called_once_with -> assert_called_once_with
  • assertEquals -> 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

hkpeprah avatar Apr 08 '24 15:04 hkpeprah

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.

frogamic avatar Jul 09 '24 07:07 frogamic

Should be fixed in 1.2.1.

hkpeprah avatar Jul 12 '24 17:07 hkpeprah