-
-
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
fixes #1210 adds stderr write for pytest.exit(msg) call #1655
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,3 +96,4 @@ Tom Viner | |
Trevor Bekolay | ||
Wouter van Ackooy | ||
Bernard Pratz | ||
Jon Sonesen |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,10 +90,12 @@ def wrap_session(config, doit): | |
session.exitstatus = doit(config, session) or 0 | ||
except pytest.UsageError: | ||
raise | ||
except KeyboardInterrupt: | ||
except KeyboardInterrupt as e: | ||
excinfo = _pytest._code.ExceptionInfo() | ||
config.hook.pytest_keyboard_interrupt(excinfo=excinfo) | ||
session.exitstatus = EXIT_INTERRUPTED | ||
except pytest.Exit as e: | ||
sys.stderr.write('{0}: {1}\n'.format(type(e).__name__, e.msg)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the session.exitstatus when pytest.Exit is caught? It looks like it might be 0 and before this change it was EXIT_INTERNALERROR. But I might be wrong... maybe check it in the test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I will have the test verify this. |
||
except: | ||
excinfo = _pytest._code.ExceptionInfo() | ||
config.notify_exception(excinfo, config.option) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few points:
as e
because the exception data is already inexcinfo
pytest.exit
ing from a test, and it now prints the msg twice - I think investigating this and why it doesn't print whenpytest.exit
ing frompytest_configure
will point to the right place to do the outputtingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes thanks for bringing this up again, I think it may have to do with the init_state logic that we were talking about prior to your departure.
I will do more work on this for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JonathonSonesen cool! Ping me a message if you wanna discuss it.