-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Pytest gives exit code 127 #8510
Comments
maybe try debugging where the exit is coming from? import sys
import pytest
import traceback
try:
pytest.main(sys.argv[1:])
except BaseException:
traceback.print_exc()
raise |
Excellent, thanks. I'll try that and report back. |
Tried the following:
Comparing (2) and (3), it seems that something between I don't know much about these internals of Python, or of pytest—are things inserted there that might have such an effect? |
my guess then is segmentation fault in some teardown? -- what happens if you don't use |
When I let GitHub Actions choose the shell, it uses
I am using pytest-cov, and out of curiosity I looked and realized it adds stuff to Is there |
it's probably not does this reproduce when you run locally on windows? there's free VMs you can try out at https://modern.ie provided by microsoft |
the other idea is to enable faulthandler, though I thought it was on by default 🤔 -- maybe try running with |
Thanks for this clue. We had indeed disabled faulthandler in order to work around an issue of noisy yet harmless console output, due either to JPype or some code that we run using it; see jpype-project/jpype#561. On re-enabling it, I see logs such as this one where faulthandler output is shown during teardown:
…however, also this one, where there is no faulthandler output, but we still get the strange exit code:
I guess the current issue could also be due to the old Java code we are running via JPype, or perhaps JPype itself. This could explain why it is beyond the reach of pytest/faulthandler to capture and display: whatever bug in Java is only triggered after pytest has finished and the other code is being torn down. Unfortunately I am out of time (and my depth, not being a Java dev) to debug this further, so I filed iiasa/ixmp#411 and introduced a workaround in iiasa/message_ix#453. I will close this for now, and re-open or file a new issue if future work shows pytest to be the culprit after all. Thanks very much @asottile for your responsiveness and helpful suggestions, they're greatly appreciated 👏🏽 |
I have a step in a GitHub Actions CI job that has a single invocation of
pytest
, like so:Pytest runs successfully, and all tests pass (see here):
However, the overall CI step and job fails, because pytest is apparently returning exit code 127—which, according to the docs, should never happen.
Further information:
Output of `pip list`, including pytest
From https://github.com/iiasa/message_ix/pull/453/checks?check_run_id=2253546265#step:17The text was updated successfully, but these errors were encountered: