Le 26/09/14 20:14, Peter Brady a écrit :
I've been trying to get better compatibility with py.test recently and have come across a very strange error:| $ py.test sympy/physics/vector/tests -k test_coordinate_vars -v ============================= test session starts ============================== platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 -- /home/ptb/miniconda3/bin/python3 architecture: 64-bit cache: yes ground types: python collected 39 items sympy/physics/vector/tests/test_frame.py:10: test_coordinate_vars FAILED =================================== FAILURES =================================== _____________________________ test_coordinate_vars _____________________________ def test_coordinate_vars(): """Tests the coordinate variables functionality"""assert CoordinateSym('Ax', A, 0) == A[0]E assert Ax == A_x E + where Ax = CoordinateSym('Ax', A, 0) sympy/physics/vector/tests/test_frame.py:12: AssertionError DO *NOT* COMMIT! =============== 38 tests deselected by '-ktest_coordinate_vars' ================ =================== 1 failed, 38 deselected in 0.22 seconds ==================== | | $ py.test sympy/physics/vector/tests/test_frame.py -k test_coordinate_vars -v ============================= test session starts ============================== platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 -- /home/ptb/miniconda3/bin/python3 architecture: 64-bit cache: yes ground types: python collected 4 items sympy/physics/vector/tests/test_frame.py:10: test_coordinate_vars PASSED ================ 3 tests deselected by '-ktest_coordinate_vars' ================ ==================== 1 passed, 3 deselected in 2.11 seconds ==================== | The same test passes or fails depending on if the test file is specified exactly or if the test is found via py.test collection... Any py.test gurus know why?
The only difference is that in the first case, all the test_ modules are imported. Calling ReferenceFrame('A') multiple times is the problem, presumably due to caching shenanigans in CoordinateSym. Here's a test that shows the issue more clearly: https://gist.github.com/rlamy/2fcb944ed462164ac4f8
-- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/5426CDD4.30002%40gmail.com. For more options, visit https://groups.google.com/d/optout.
