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

Python 3.13.0b2 doctest failures #2214

Open
hroncok opened this issue Jun 15, 2024 · 2 comments
Open

Python 3.13.0b2 doctest failures #2214

hroncok opened this issue Jun 15, 2024 · 2 comments

Comments

@hroncok
Copy link
Contributor

hroncok commented Jun 15, 2024

In Fedora, I get the following 2 failures on Python 3.13.0b2 when I build pythran 0.16.1:

____________________________ TestDoctest.test_utils ____________________________
[gw47] linux -- Python 3.13.0 /usr/bin/python3
self = <pythran.tests.test_xdoc.TestDoctest testMethod=test_utils>
>   lambda self: generic_test_package(self, module))
pythran/tests/test_xdoc.py:89: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pythran/tests/test_xdoc.py:83: in generic_test_package
    self.assertEqual(failed, 0)
E   AssertionError: 1 != 0
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/pythran-0.16.1-build/pythran-0.16.1/pythran/utils.py", line 108, in pythran.utils.get_variable
Failed example:
    ast.dump(get_variable(ref))
Expected:
    "Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
Got:
    "Name(id='a', ctx=Load())"
**********************************************************************
1 item had failures:
   1 of   3 in pythran.utils.get_variable
***Test Failed*** 1 failure.
__________________________ TestDoctest.test_tutorial ___________________________
[gw218] linux -- Python 3.13.0 /usr/bin/python3
self = <pythran.tests.test_xdoc.TestDoctest testMethod=test_tutorial>
    @pytest.mark.skipif(sys.platform == "win32",
                        reason="We should create a file for windows.")
    def test_tutorial(self):
        failed, _ = doctest.testfile('../../docs/TUTORIAL.rst')
>       self.assertEqual(failed, 0)
E       AssertionError: 4 != 0
pythran/tests/test_xdoc.py:25: AssertionError
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/pythran-0.16.1-build/pythran-0.16.1/pythran/tests/../../docs/TUTORIAL.rst", line 22, in TUTORIAL.rst
Failed example:
    print(ast.dump(tree))  # view it as a string
Expected:
    Module(body=[Assign(targets=[Name(id='a', ctx=Store(), annotation=None, type_comment=None)], value=Constant(value=1, kind=None), type_comment=None)], type_ignores=[])
Got:
    Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Constant(value=1))])
**********************************************************************
File "/builddir/build/BUILD/pythran-0.16.1-build/pythran-0.16.1/pythran/tests/../../docs/TUTORIAL.rst", line 35, in TUTORIAL.rst
Failed example:
    print(ast.dump(tree))
Expected:
    Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param(), annotation=None, type_comment=None)], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load(), annotation=None, type_comment=None), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=1, kind=None))], keywords=[]), op=Add(), right=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=2, kind=None))], keywords=[]))))], decorator_list=[], returns=None, type_comment=None)], type_ignores=[])
Got:
    Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param())]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load()), ops=[Lt()], comparators=[Constant(value=2)]), body=Name(id='n', ctx=Load()), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=1))]), op=Add(), right=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=2))]))))])])
**********************************************************************
File "/builddir/build/BUILD/pythran-0.16.1-build/pythran-0.16.1/pythran/tests/../../docs/TUTORIAL.rst", line 201, in TUTORIAL.rst
Failed example:
    sorted(map(ast.dump, ce))
Expected:
    ["Attribute(value=Name(id='math', ctx=Load(), annotation=None, type_comment=None), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
Got:
    ["Attribute(value=Name(id='math', ctx=Load()), attr='cos', ctx=Load())", 'Constant(value=3)']
**********************************************************************
File "/builddir/build/BUILD/pythran-0.16.1-build/pythran-0.16.1/pythran/tests/../../docs/TUTORIAL.rst", line 212, in TUTORIAL.rst
Failed example:
    print(ast.dump(returned))
Expected:
    Name(id='b', ctx=Load(), annotation=None, type_comment=None)
Got:
    Name(id='b', ctx=Load())
**********************************************************************
1 item had failures:
   4 of  79 in TUTORIAL.rst
***Test Failed*** 4 failures.
@serge-sans-paille
Copy link
Owner

This is due to a change in ast.dump. I'll fix this in #2217

@serge-sans-paille
Copy link
Owner

Should be better now that #2218 got merged (thanks to 840a0e7)

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