pytest: Occasional AST constructor depth mismatch

  • a detailed description of the bug or problem you are having

In some of our CI runs in the ibis project we occasionally see failures around AST depths mismmatching.

It’s hard for me to reproduce locally.

  • ~output of pip list from the virtual environment you are using~

The number of transitive dependencies for ibis is large. I’m happy to list them here, but it may require a bit of discussion/help to get someone setup to reproduce this

  • pytest and operating system versions

pytest: 7.2.2 os: linux 6.1.2 (NixOS)

  • ~[ ] minimal example if possible~

I don’t know exactly what is minimal here, I’m having trouble reproducing it locally.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

No worries, I understand!

One thing I can think of to reproduce the problem is to use a pytest fork which uses a try/except block around the ast.parse call:

INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.11/site-packages/_pytest/_code/source.py", line 185, in getstatementrange_ast
INTERNALERROR>     astnode = ast.parse(content, "source", "exec")

When that raises a SystemError, dump content to a file. Hopefully then you can use that content to create a smaller reproducer.