assay icon indicating copy to clipboard operation
assay copied to clipboard

Python 3.11 errors in skyfield tests

Open bnavigator opened this issue 2 years ago • 1 comments

There is no dis.POP_JUMP_IF_TRUE in Python 3.11 anymore. (Compare https://docs.python.org/3.11/library/dis.html vs https://docs.python.org/3.10/library/dis.html)

[    8s] + python3.10 -m assay --batch skyfield.tests
[    9s] ..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[    9s] 
[    9s] All 554 tests passed in 1.14 seconds
[    9s] + python3.11 -m assay --batch skyfield.tests
[    9s] Traceback (most recent call last):
[    9s]   File "<frozen runpy>", line 198, in _run_module_as_main
[    9s]   File "<frozen runpy>", line 88, in _run_code
[    9s]   File "/home/abuild/rpmbuild/BUILD/assay-bb62d1f7d51d798b05a88045fff3a2ff92c299c3/assay/__main__.py", line 1, in <module>
[    9s]     from assay.command import main
[    9s]   File "/home/abuild/rpmbuild/BUILD/assay-bb62d1f7d51d798b05a88045fff3a2ff92c299c3/assay/command.py", line 8, in <module>
[    9s]     from . import monitor, unix
[    9s]   File "/home/abuild/rpmbuild/BUILD/assay-bb62d1f7d51d798b05a88045fff3a2ff92c299c3/assay/monitor.py", line 12, in <module>
[    9s]     from .runner import capture_stdout_stderr, run_tests_of
[    9s]   File "/home/abuild/rpmbuild/BUILD/assay-bb62d1f7d51d798b05a88045fff3a2ff92c299c3/assay/runner.py", line 11, in <module>
[    9s]     from .assertion import get_code, search_for_function, rewrite_asserts_in
[    9s]   File "/home/abuild/rpmbuild/BUILD/assay-bb62d1f7d51d798b05a88045fff3a2ff92c299c3/assay/assertion.py", line 122, in <module>
[    9s]     op.pop_jump_if_true, b'.',
[    9s]     ^^^^^^^^^^^^^^^^^^^
[    9s] AttributeError: type object 'op' has no attribute 'pop_jump_if_true'

bnavigator avatar Feb 19 '23 20:02 bnavigator

Thanks for the heads-up! I'll take a look at this when I get an opportunity—hopefully there will still be leeway within the bytecode, even without that instruction, to perform the rewrite that instruments the asserts.

brandon-rhodes avatar Feb 20 '23 12:02 brandon-rhodes

Fixed by the commits up to current 74617d70e77afa09f58b3169cf496679ac5d5621

bnavigator avatar Mar 24 '24 11:03 bnavigator

@bnavigator — I hadn't pinged this thread yet because, before announcing the compatibility, I was thinking of making an actual release of assay on PyPI for you. Remind me if that would help your process? Or is it just as easy for you to install from the github .zip?

brandon-rhodes avatar Mar 25 '24 03:03 brandon-rhodes

Since I only use it for testing skyfield after the build process, the GitHub archive from a designated commit has been sufficient for me: https://build.opensuse.org/request/show/1161329

bnavigator avatar Mar 25 '24 08:03 bnavigator