Closed
Description
The assertion rewriting in pytest changes the source position for all nodes in the assertion to the source range of the assertion.
pytest/src/_pytest/assertion/rewrite.py
Lines 976 to 978 in 9515dfa
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.
- Support pytest alexmojaki/executing#2 (comment) executing does not work inside assertions.
- Allow fixing snapshots without disabling pytest rewriting 15r10nk/inline-snapshot#57 I have to disable assertion rewriting to be able to find ast-nodes with executing.
- ... maybe more
I already created a pull-request to solve this problem #12815.
Metadata
Metadata
Assignees
Labels
No labels