You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
py.test assert rewriting broken with Python 3.5a4+ #744
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:137: in find_module
source_stat, co = _rewrite_test(state, fn_pypath)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:278: in _rewrite_test
rewrite_asserts(tree)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:336: in rewrite_asserts
AssertionRewriter().run(mod)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:550: in run
new.extend(self.visit(child))
/usr/local/lib/python3.5/ast.py:245: in visit
return visitor(node)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:658: in visit_Assert
top_condition, explanation = self.visit(assert_.test)
/usr/local/lib/python3.5/ast.py:245: in visit
return visitor(node)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:789: in visit_Compare
left_res, left_expl = self.visit(comp.left)
/usr/local/lib/python3.5/ast.py:245: in visit
return visitor(node)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:640: in generic_visit
return res, self.explanation_param(self.display(res))
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:577: in display
return self.helper("saferepr", expr)
/usr/local/lib/python3.5/site-packages/_pytest/assertion/rewrite.py:583: in helper
return ast.Call(attr, list(args), [], None, None)
E TypeError: Call constructor takes either 0 or 3 positional arguments
I get this as soon as I have an assert statement in my test (even assert True).
Original comment byMatthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
This is due to 95886 , that fixes Missing *-unpacking generalizations and change the signature of _ast.Call as far as I can tell. I guess the change of signature might have to be added in What's new, or someone should add compatibility layer in ast.
Original comment byMatthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
I don't know, I came across the same bug this morning, found this issue and started digging, I have never contributed to pytest either so I'm not that familiar with the codebase. The AST has no compat and not a lot of docs either, but I achieved to get a partial workaround here for now.NOt sure I have a lot of time to put on that next week, but I'll try. After it might be a start point for the maintainers of pytest.
Oh, sorry. I don't know who's who on the project, and since you were the first and only one to reply to the bug, I assumed you were one of the maintainers. :-) Thanks for the fix!
Original comment byThomas Kluyver (BitBucket: takluyver, GitHub: takluyver):
Re not a lot of docs: I maintain some extra documentation about working with ASTs at http://greentreesnakes.readthedocs.org/en/latest/ , though it doesn't yet describe Python 3.5. Pull requests welcome, especially once 3.5 is a bit closer to release.
Original comment byMatthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
Yes, I just cloned it to potentially make some adjustements. I'm also reading about Argument Clinic to see if some docs could be added to _ast in C source in 3.5. Though I haven't touched C in almost a decade already.
At least some of the failures are due to this but (which affects the test suites of those packages run at build time). I'll watch this bug and try to hotfix our pytest package for the rebuild once a patch is available.
I'm curious whether anyone is actively working on this issue. It's definitely the top related failure I'm seeing in our Ubuntu Python 3.5 test rebuilds.
No sorry, i've read 2.5 instead of 3.5. 3.5 is still supported of course,
but it doesn't cause any issue with latest pytest I think.
Le 4 avr. 2016 21:06, "Rémi Alvergnat" toilal.dev@gmail.com a écrit :
I don't know. I've dropped python 3.5 support in my projects.
Le 4 avr. 2016 20:44, "Brett M. Morris" notifications@github.com a
écrit :
@Toilalhttps://github.com/Toilal Any updates on your recommendation
above? I'm still getting the originally posted traceback after using your
fix.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #744 (comment)
I think that's going to get interpreted as the command pip install pytest, which is being redirected with the > shell operator to a file named =2.7.3 --upgrade or so.
Activity
pytestbot commentedon May 17, 2015
Original comment by Matthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
This is due to 95886 , that fixes Missing *-unpacking generalizations and change the signature of
_ast.Callas far as I can tell. I guess the change of signature might have to be added in What's new, or someone should add compatibility layer inast.pytestbot commentedon May 17, 2015
Original comment by BitBucket: gvanrossum, GitHub: gvanrossum:
But are you going to fix it? There is no compatibility guarantee for the ast module.
pytestbot commentedon May 17, 2015
Original comment by Matthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
I don't know, I came across the same bug this morning, found this issue and started digging, I have never contributed to pytest either so I'm not that familiar with the codebase. The AST has no compat and not a lot of docs either, but I achieved to get a partial workaround here for now.NOt sure I have a lot of time to put on that next week, but I'll try. After it might be a start point for the maintainers of pytest.
pytestbot commentedon May 17, 2015
Original comment by BitBucket: gvanrossum, GitHub: gvanrossum:
Oh, sorry. I don't know who's who on the project, and since you were the first and only one to reply to the bug, I assumed you were one of the maintainers. :-) Thanks for the fix!
pytestbot commentedon May 17, 2015
Original comment by Matthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
No problem, the same happen to me often. Thanks for CPython in general, pushing people toward 3.5 as much as I can !
pytestbot commentedon May 18, 2015
Original comment by Thomas Kluyver (BitBucket: takluyver, GitHub: takluyver):
Re not a lot of docs: I maintain some extra documentation about working with ASTs at http://greentreesnakes.readthedocs.org/en/latest/ , though it doesn't yet describe Python 3.5. Pull requests welcome, especially once 3.5 is a bit closer to release.
pytestbot commentedon May 18, 2015
Original comment by Matthias Bussonnier (BitBucket: Carreau, GitHub: Carreau):
Yes, I just cloned it to potentially make some adjustements. I'm also reading about Argument Clinic to see if some docs could be added to
_astin C source in 3.5. Though I haven't touched C in almost a decade already.pytestbot commentedon Jun 3, 2015
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):
For the record, work is ongoing at https://bitbucket.org/pytest-dev/pytest/pull-request/296/astcall-signature-changed-on-35/diff , thanks to Matthias. Hopefully we can merge it soon and release pytest-2.7.2 with it.
warsaw commentedon Jun 19, 2015
In Ubuntu, we're doing a test rebuild with Python 3.5 as the default Python 3 version:
https://launchpad.net/~pythoneers/+archive/ubuntu/py35asdefault/+packages?batch=75
At least some of the failures are due to this but (which affects the test suites of those packages run at build time). I'll watch this bug and try to hotfix our pytest package for the rebuild once a patch is available.
warsaw commentedon Jun 23, 2015
@dstufft says: --assert=plain may help temporarily.
warsaw commentedon Jun 23, 2015
I looked at that bitbucket patch and unfortunately it doesn't make the test suite pass for me with Python 3.5
jonathaneunice commentedon Jul 7, 2015
Just reconfirmed the bug. Still an issue with Python 3.5.0b3 (released July 5).
This is a show-stopper for me doing any work with 3.5. I can't proceed without a working test rig.
The-Compiler commentedon Jul 8, 2015
@jonathaneunice as a workaround, you can use
--assert=plainuntil this is fixed.warsaw commentedon Jul 10, 2015
I'm curious whether anyone is actively working on this issue. It's definitely the top related failure I'm seeing in our Ubuntu Python 3.5 test rebuilds.
29 remaining items
The-Compiler commentedon Sep 15, 2015
@ByteCommander it was already fixed in July in #801, and a new pytest version (2.7.3) with the fix was released today.
So your best bet would be to update 😉 As a workaround, as mentioned earlier in this thread, you can use
--assert=plainflub commentedon Sep 16, 2015
py.test 2.7.3 has been released with support for Python 3.5
On 15 Sep 2015 21:53, "Barry Warsaw" notifications@github.com wrote:
warsaw commentedon Sep 16, 2015
On Sep 16, 2015, at 03:47 AM, Floris Bruynooghe wrote:
Thanks for that! Debian now has this version without the custom patch. :)
Toilal commentedon Sep 18, 2015
For people using travis CI, use this command in travis.yml
use --assert=plain on Travis
travis: upgrade pytest version for Python 3.5
bmorris3 commentedon Apr 4, 2016
@Toilal Any updates on your recommendation above? I'm still getting the originally posted traceback after using your fix.
Toilal commentedon Apr 4, 2016
I don't know. I've dropped python 3.5 support in my projects.
Le 4 avr. 2016 20:44, "Brett M. Morris" notifications@github.com a écrit :
Toilal commentedon Apr 4, 2016
No sorry, i've read 2.5 instead of 3.5. 3.5 is still supported of course,
but it doesn't cause any issue with latest pytest I think.
Le 4 avr. 2016 21:06, "Rémi Alvergnat" toilal.dev@gmail.com a écrit :
The-Compiler commentedon Apr 4, 2016
@bmorris3 Looking at https://travis-ci.org/bmorris3/shampoo/jobs/120545149 you're running pytest 2.5.1, which is from December 2013. This was fixed in 2.7.3, and the current release is 2.9.1. In other words, please upgrade 😉
bmorris3 commentedon Apr 4, 2016
Thanks for pointing that out – I don't understand why my inclusion of:
in my
.travis.ymldidn't upgrade to the latest pip, but that's on me for figuring out.dstufft commentedon Apr 5, 2016
I think that's going to get interpreted as the command
pip install pytest, which is being redirected with the>shell operator to a file named=2.7.3 --upgradeor so.bmorris3 commentedon Apr 5, 2016
@dstufft I wondered that myself in this commit, but it failed the tests similarly.
Fix test on Python 3.5+
Suppress warnings caused by map([], ' "x" ') (#259)