Closed oroppas closed 3 years ago
Hello, Ryuta,
GraapPython doesn't build the same AST as CPython and the ast module is not implemented yet.
Best Regards, Petr
On Thu, May 13, 2021 at 12:09 PM Ryuta Suzuki @.***> wrote:
When I tried piconumpy https://github.com/hpyproject/piconumpy test, I've got this attribute error. It's not related to piconumpy, but rather comes from pytest
... File "/home/ryuta/.local/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 673, in run if not mod.body:AttributeError: 'code' object has no attribute 'body'
Minimal reproducible is
import ast tree = ast.parse("1/3")print(tree.body)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/oracle/graalpython/issues/212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFW2BPYBAZ7KKONOR2CBDTNOQMTANCNFSM442I643A .
Hi Petr,
Thanks for the explanation. I keep this issue open as a reminder.
We patch pytest not to use ast
, so your example should work. Our patch just disables the assertion rewriting and the advanced traceback printer, which you can also disable from the commandline with --assert=plain --tb=native
as a workaround. The package patching sometimes doesn't kick in when people update pip
or make some other changes to the virtualenv. Could you please provide the full steps to reproduce including the virtualenv creation and the command to run the tests?
I forgot about --assert=plain --tb=native
. Now I see TypeError: unsupported operand type(s) for |: 'dict' and 'dict_keys'
Let me sort things out and I report it back to you.
@oroppas Hi, can you retry whether this is still an issue after the other fixes?
Hi @msimacek
Thanks for the fix. I don't see the issues anymore.
graalpython -m pytest piconumpy -s
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.8.5, pytest-5.1.0, py-1.8.0, pluggy-0.13.1
rootdir: /u/cd4mcq/packages/graalvm/graalpython/numpy/piconumpy
collected 0 items / 5 errors
================================================================================================================== ERRORS ==================================================================================================================
_____________________________________________________________________________________________ ERROR collecting piconumpy/test_cpython_capi.py ______________________________________________________________________________________________
Module could not be imported, the test could be unsupported by GraalPython
________________________________________________________________________________________________ ERROR collecting piconumpy/test_cython.py _________________________________________________________________________________________________
Module could not be imported, the test could be unsupported by GraalPython
__________________________________________________________________________________________________ ERROR collecting piconumpy/test_hpy.py __________________________________________________________________________________________________
Module could not be imported, the test could be unsupported by GraalPython
________________________________________________________________________________________________ ERROR collecting piconumpy/test_purepy.py _________________________________________________________________________________________________
Module could not be imported, the test could be unsupported by GraalPython
_____________________________________________________________________________________________ ERROR collecting piconumpy/test_purepy_array.py ______________________________________________________________________________________________
Module could not be imported, the test could be unsupported by GraalPython
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================================= 5 error in 1.57s =============================================================================================================
Any plan for ast module implementation?
When I tried piconumpy test, I've got this attribute error. It's not related to piconumpy, but rather comes from pytest
Minimal reproducible is