Strange behavior with py.test

17 views
Skip to first unread message

Peter Brady

unread,
Sep 26, 2014, 3:14:10 PM9/26/14
to sy...@googlegroups.com
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?

Ronan Lamy

unread,
Sep 27, 2014, 10:46:46 AM9/27/14
to sy...@googlegroups.com
Le 26/09/14 20:14, Peter Brady a écrit :
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

Peter Brady

unread,
Sep 27, 2014, 5:17:41 PM9/27/14
to sy...@googlegroups.com
Thanks for clearing that up.  I've made an issue based on your gist https://github.com/sympy/sympy/issues/8121



--
You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/OqW6m8xz6Ic/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
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.

Reply all
Reply to author
Forward
0 new messages