Closed jerry-git closed 1 year ago
Hey @jerry-git Thanks a lot for the report.
I can reproduce the issue. This is somehow connected to pytest's assertion rewriting. I will have to figure out where the error comes from.
Until I do, you can disable assertion rewriting. While this will disable the nice error messages, at least there won't be any errors. You can change the config via:
import ipytest
ipytest.autoconfig(rewrite_asserts=False)
Explanation:
Related PyTest issue:
Simple repo:
import ast
from _pytest.assertion.rewrite import rewrite_asserts
code = """# hello
a = 2
"""
mod = ast.parse(code)
rewrite_asserts(mod, b"")
mod = ast.fix_missing_locations(mod)
compile(mod, "foo.py", "exec")
# ValueError: AST node line range (2, 1) is not valid
@jerry-git FYI, when I execute the integration tests locally with python 3.11, I get a test failure:
@jerry-git I released ipytest==0.13.2b0
with a fix. Would be cool, if you could have look, whether this solves your issue. I will also test it a for a bit and then do a proper 0.13.2
release.
@chmp Appreciate the heads-up over at the pytest repo, and the quick fix! I use ipytest for company trainings/talks about pytest, and I bet this would have bitten me with a live demo-heavy talk next week :sweat_smile:
@The-Compiler thanks for the feedback. Always nice to hear that someone is using your stuff :) Not sure I will manage a proper release until next week, so hopefully the pre-release works for you. I would be interested to hear whether your content works with the fix without any issues.
when I execute the integration tests locally with python 3.11, I get a test failure ...
That's great! I guess I didn't run the integration tests, just the unit ones.
Would be cool, if you could have look, whether this solves your issue.
Yup, works 👍
Thanks for the swift reaction 🙏
Thanks for the feedback. Glad everything works.
Released as v0.13.2
Versions: Python 3.11 and
ipytest==0.13.1
.Comments at the beginning of code cells cause crashes after
ipytest.autoconfig()
has been executed. Here's a simple example:FWIW, I tried running the
ipytest
test suite with 3.11, no failures.