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

Permutation repr test failure in master #17884

Closed
asmeurer opened this issue Nov 12, 2019 · 3 comments · Fixed by #17891
Closed

Permutation repr test failure in master #17884

asmeurer opened this issue Nov 12, 2019 · 3 comments · Fixed by #17891
Labels
Milestone

Comments

@asmeurer
Copy link
Member

$./bin/test repr perm
===================================================================================================== test process starts =====================================================================================================
executable:         /home/aaronmeurer/anaconda3/bin/python  (3.7.3-final-0) [CPython]
architecture:       64-bit
cache:              yes
ground types:       gmpy 2.1.0b1
numpy:              1.17.3
random seed:        57948523
hash randomization: on (PYTHONHASHSEED=372740668)

sympy/combinatorics/tests/test_perm_groups.py[57] ...............f...............f................w........                                                                                                                [OK]
sympy/combinatorics/tests/test_permutations.py[11] ...........                                                                                                                                                             [OK]
sympy/physics/quantum/tests/test_represent.py[9] .........                                                                                                                                                                 [OK]
sympy/printing/tests/test_lambdarepr.py[9] .........                                                                                                                                                                       [OK]
sympy/printing/tests/test_repr.py[41] ........................................F                                                                                                                                          [FAIL]

_______________________________________________________________________________________________________________________________________________________________________________________________________________________________
_____________________________________________________________________________________ sympy/printing/tests/test_repr.py:test_Permutation ______________________________________________________________________________________
Traceback (most recent call last):
  File "/home/aaronmeurer/Documents/python/sympy/sympy/sympy/printing/tests/test_repr.py", line 305, in test_Permutation
    sT(Permutation(1, 2), "Permutation(1, 2)", import_stmt)
  File "/home/aaronmeurer/Documents/python/sympy/sympy/sympy/printing/tests/test_repr.py", line 34, in sT
    assert srepr(expr) == string
AssertionError

==================================================================== tests finished: 123 passed, 1 failed, 1 skipped, 2 expected to fail, in 2.20 seconds =====================================================================
DO *NOT* COMMIT!

We can probably work around this by making sure print_cyclic is set correctly in the repr test.

In the longer term, I think we should get rid of that flag #15201.

@aditisingh2362
Copy link
Contributor

I would like to work on this issue.

@sylee957
Copy link
Member

You may have to modify the tests to specify the variable temporarily and make it automatically revert to the default value like this.

$ git diff
diff --git a/sympy/printing/tests/test_repr.py b/sympy/printing/tests/test_repr.py
index dc9ce7bb58..301bf46596 100644
--- a/sympy/printing/tests/test_repr.py
+++ b/sympy/printing/tests/test_repr.py
@@ -302,4 +302,7 @@ def test_Cycle():

 def test_Permutation():
     import_stmt = "from sympy.combinatorics import Permutation"
+    print_cyclic = Permutation.print_cyclic
+    Permutation.print_cyclic = True
     sT(Permutation(1, 2), "Permutation(1, 2)", import_stmt)
+    Permutation.print_cyclic = print_cyclic

@sylee957
Copy link
Member

sylee957 commented Nov 13, 2019

And I don't think that this should be blocking the next release since this is a gotcha about mutating class variables.
And this does not happen on the travis test, travis had luckily split the combinatorics test and the printing test.
This only happens if you test combinatorics and test_repr in the same stage.

Okay, I didn’t notice that the full test had to be passed before releasing.

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

Successfully merging a pull request may close this issue.

3 participants