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
TST: rare flakyness (or pollution) in a recently introduced subprocess-based test #17775
It is extremely puzzling to me that this test might fail in a subprocess, let alone have anything to do with pollution, but unfortunately it is also very hard to debug; I don't even have a good traceback to work with. All I have is
subprocess.CalledProcessError: Command '['/Users/clm/dev/astropy-project/coordinated/astropy/.venv/bin/python3', '-c', "\nimport astropy, sys\nassert 'astropy.units' not in sys.modules\nastropy.units\nassert 'astropy.units' in sys.modules\n"]' returned non-zero exit status 1.
I don't have a clear idea how to rewrite this test to at least make it easier to debug when it fails. I tried using monkeypatch.delitem(sys.modules, "astropy.units", raising=False), but it doesn't suffice to simulate "astropy.units has not been imported yet" and the second assert statement fails.
I wish I had any clue -- obviously the whole point of using the subprocess was to ensure that it is just like having a new python process. In principle, I think one can keep the output of subprocess, so that might help in debugging future instances. Or perhaps instead it should call the pytest executable instead so one gets more of a report?
Yes, I ran the whole test suite twice, specifically without docs, though I doubt that it has anything to do with it. In hindsight, I need to try to reproduce this, maybe it's actually not that random.
Activity
pllim commentedon Feb 12, 2025
Ugh I wonder if we need a new flag to skip this test from double run...
mhvk commentedon Feb 12, 2025
I wish I had any clue -- obviously the whole point of using the subprocess was to ensure that it is just like having a new python process. In principle, I think one can keep the output of
subprocess, so that might help in debugging future instances. Or perhaps instead it should call thepytestexecutable instead so one gets more of a report?pllim commentedon Feb 12, 2025
Would something like this be good enough?
pytest-dev/pytest#12188
mhvk commentedon Feb 12, 2025
@neutrinoceros - did you encounter the problem in running tests twice? Or was it more random still?
neutrinoceros commentedon Feb 12, 2025
Yes, I ran the whole test suite twice, specifically without docs, though I doubt that it has anything to do with it. In hindsight, I need to try to reproduce this, maybe it's actually not that random.