Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure with Python 3.13.0b3 #19

Closed
arkamar opened this issue Jun 29, 2024 · 1 comment
Closed

Test failure with Python 3.13.0b3 #19

arkamar opened this issue Jun 29, 2024 · 1 comment

Comments

@arkamar
Copy link

arkamar commented Jun 29, 2024

This is similar issue to #16, the test_sys_modules test fails with Python 3.13.0b3 even if I apply the patch from PR #17 (however, I confirm it resolves the issue with Python 3.13.0b1).

================================================= test session starts =================================================
platform linux -- Python 3.13.0b3, pytest-8.2.2, pluggy-1.5.0 -- /var/tmp/portage/dev-python/pure-eval-0.2.2/work/pure_eval-0.2.2-python3_13/install/usr/bin/python3.13
cachedir: .pytest_cache
rootdir: /var/tmp/portage/dev-python/pure-eval-0.2.2/work/pure_eval-0.2.2
configfile: pyproject.toml
collecting ... collected 47 items

[snip]
tests/test_utils.py::test_sys_modules FAILED                                                                   [41/47]
[snip]
====================================================== FAILURES =======================================================
__________________________________________________ test_sys_modules ___________________________________________________

    def test_sys_modules():
        modules = sys_modules_sources()
        if not os.environ.get('PURE_EVAL_SLOW_TESTS'):
            modules = islice(modules, 0, 3)

        for filename, source, tree in modules:
            print(filename)
            if not filename.endswith("ast.py"):
>               check_copy_ast_without_context(tree)
[snip]
tests/test_utils.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tree = <ast.Module object at 0x7f3462e4f4d0>

    def check_copy_ast_without_context(tree):
        tree2 = copy_ast_without_context(tree)
        dump1 = ast.dump(tree)
        dump2 = ast.dump(tree2)
        normalised_dump1 = re.sub(
            # Two possible matches:
            # - first one like ", ctx=…" where ", " should be removed
            # - second one like "(ctx=…" where "(" should be kept
            (
                r"("
                    r", ctx=(Load|Store|Del)\(\)"
                r"|"
                    r"(?<=\()ctx=(Load|Store|Del)\(\)"
                r")"
            ),
            "",
            dump1
        )
>       assert normalised_dump1 == dump2
E       assert 'Module(body=[Expr(value=Constant(value=\'Core implementation of import.\\n\\nThis module is NOT meant to be directly imported! It has been designed such\\nthat it can be bootstrapped into Python as the implementation[snip]
E
E         - Module(body=[Expr(value=Constant(value='Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import.[snip]
E         + Module(body=[Expr(value=Constant(value='Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import.[snip]
[snip]
======================================= 1 failed, 46 passed, 1 warning in 9.88s =======================================
@alexmojaki
Copy link
Owner

Fixed in #18, released in 0.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants