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

assertion rewriting ignores the original source positions #12818

Open
15r10nk opened this issue Sep 15, 2024 · 0 comments · May be fixed by #12815
Open

assertion rewriting ignores the original source positions #12818

15r10nk opened this issue Sep 15, 2024 · 0 comments · May be fixed by #12815

Comments

@15r10nk
Copy link

15r10nk commented Sep 15, 2024

The assertion rewriting in pytest changes the source position for all nodes in the assertion to the source range of the assertion.

for stmt in self.statements:
for node in traverse_node(stmt):
ast.copy_location(node, assert_)

This causes problems for tools like executing which uses these source ranges (since python 3.11) to provide a mapping back to the ast-node.

This causes the following problems.

I already created a pull-request to solve this problem #12815.

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

Successfully merging a pull request may close this issue.

1 participant