-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of usersstatus: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogmight present some backward compatibility issues which should be carefully noted in the changelogtype: bugproblem that needs to be addressedproblem that needs to be addressedtype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Milestone
Description
Hi there,
It seems like the @ operator isn't recognized by something int the assertion_rewrite procedure.
With --assert=plain there is no problem.
I did some fake test to single out the problem in fake_matrix.py:
class FakeMatrix:
def __init__(self, num):
self.num = num
def __matmul__(self, other):
return self.num * other.num
and the test file:
from fake_matrix import FakeMatrix
def test_multmat_operator():
assert FakeMatrix(2) @ FakeMatrix(3) == 6
traceback:
platform linux -- Python 3.5.0+, pytest-2.8.5, py-1.4.31, pluggy-0.3.1 -- /home/snail/.virtualenvs/fip/bin/python3.5
cachedir: .cache
rootdir: /home/snail/comp/python/fluent/pytest_bug_report, inifile:
collected 0 items / 1 errors
================================================================= ERRORS =================================================================
____________________________________________________ ERROR collecting test_multmat.py ____________________________________________________
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:969: in _find_and_load
???
<frozen importlib._bootstrap>:954: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:892: in _find_spec
???
<frozen importlib._bootstrap>:873: in _find_spec_legacy
???
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:143: in find_module
source_stat, co = _rewrite_test(state, fn_pypath)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:290: in _rewrite_test
rewrite_asserts(tree)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:348: in rewrite_asserts
AssertionRewriter().run(mod)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:569: in run
new.extend(self.visit(child))
/usr/lib/python3.5/ast.py:245: in visit
return visitor(node)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:677: in visit_Assert
top_condition, explanation = self.visit(assert_.test)
/usr/lib/python3.5/ast.py:245: in visit
return visitor(node)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:852: in visit_Compare
left_res, left_expl = self.visit(comp.left)
/usr/lib/python3.5/ast.py:245: in visit
return visitor(node)
/home/snail/.virtualenvs/fip/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:761: in visit_BinOp
symbol = binop_map[binop.op.__class__]
E KeyError: <class '_ast.MatMult'>
My system is debian linux stretch, and as you can see I'm using Python 3.5.0+, pytest-2.8.5 on a virtualenv
Metadata
Metadata
Assignees
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of usersstatus: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogmight present some backward compatibility issues which should be carefully noted in the changelogtype: bugproblem that needs to be addressedproblem that needs to be addressedtype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch