brandon-rhodes / assay

Attempt to write a Python testing framework I can actually stand
25 stars 7 forks source link

Python 3.11 errors in skyfield tests #15

Closed bnavigator closed 5 months ago

bnavigator commented 1 year ago

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'
brandon-rhodes commented 1 year ago

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.

bnavigator commented 5 months ago

Fixed by the commits up to current 74617d70e77afa09f58b3169cf496679ac5d5621

brandon-rhodes commented 5 months ago

@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?

bnavigator commented 5 months ago

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