Skip to content

bpo-9495: argparse unittest tracebacks are confusing if an error is raised when not expected #17120

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

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def stderr_to_parser_error(parse_args, *args, **kwargs):
code = sys.exc_info()[1].code
stdout = sys.stdout.getvalue()
stderr = sys.stderr.getvalue()
raise ArgumentParserError("SystemExit", stdout, stderr, code)
raise ArgumentParserError(
"SystemExit", stdout, stderr, code) from None
finally:
sys.stdout = old_stdout
sys.stderr = old_stderr
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ Gilles Civario
Chris Clark
Diana Clarke
Laurie Clark-Michalek
Alexander Clarkson
Mike Clarkson
Andrew Clegg
Brad Clements
Expand Down