Skip to content

Assert rewriting failure for multiple 'and' #61

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

Closed
pytestbot opened this issue Jul 12, 2011 · 1 comment
Closed

Assert rewriting failure for multiple 'and' #61

pytestbot opened this issue Jul 12, 2011 · 1 comment
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Ronan Lamy (BitBucket: rlamy, GitHub: rlamy)


Consider this test file:

#!python

def test_and():
    assert 1+1 == 2 and 2+2==4 and 4+4 == 8

With 2.1.0, assert rewriting fails with an AttributeError. I see that the typo causing it (ast.Boolop instead of ast.BoolOp) has already been fixed. However, when I fix it locally, I get another error:

#!

================================================= test session starts =================================================
platform linux2 -- Python 2.7.1 -- pytest-2.1.0
collected 0 items / 1 errors 

======================================================= ERRORS ========================================================
___________________________________________ ERROR collecting test_pytest.py ___________________________________________
../std_env/lib/python2.7/site-packages/py/_path/local.py:529: in pyimport
>           mod = __import__(modname, None, None, ['__doc__'])
../std_env/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:99: in find_module
>           co = _make_rewritten_pyc(state, fn_pypath, pyc)
../std_env/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:156: in _make_rewritten_pyc
>           co = compile(tree, fn.strpath, "exec")
E           TypeError: BoolOp field "values" must be a list, not a tuple
=============================================== 1 error in 0.10 seconds ===============================================

@pytestbot
Copy link
Contributor Author

Original comment by Benjamin Peterson (BitBucket: gutworth, GitHub: gutworth):


This is already resolved in hg.

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
mgorny pushed a commit to mgorny/pytest that referenced this issue May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant