Uh oh!
There was an error while loading. Please reload this page.
gh-103186: Fix or catch 'extra' stderr output from unittests - #103196
Conversation
The exception raised is expected and is part of the unit test
This comment was marked as resolved.
This comment was marked as resolved.
TabLand
commented
Apr 2, 2023
Please let me know if changes to individual files should be separated, would this separation have to be done both at the commit and branch level? |
terryjreedy
commented
Apr 3, 2023
The azure pipeline failure page is https://dev.azure.com/Python/cpython/_build/results?buildId=123893&view=logs&j=d554cd63-f8f4-5b2d-871b-33e4ea76e915&t=5a14d0eb-dbd4-5b80-f5d0-7909f950a1cc. In the first run, "3 tests failed: test_asyncgen test_logging test_subprocess". In the rerun, all 3 passed, but a normal sys.exit(0) failed with a PermissionError. We have seen this before, but I thought it was fixed. I am dubious that the patch would be responsible. I may ask about this tomorrow. These three files together look fine together. I think that changes look good; will try to do some testing tomorrow. |
TabLand
commented
Apr 3, 2023
Thanks Terry! |
TabLand
commented
Jul 8, 2023
bump! |
terryjreedy
left a comment
There was a problem hiding this comment.
I verified that these 3 tests run cleanly on Windows.
miss-islington
commented
Jul 10, 2023
Thanks @TabLand for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
miss-islington
commented
Jul 10, 2023
Sorry, @TabLand and @terryjreedy, I could not cleanly backport this to |
…ythonGH-103196) Reduce test noise by fixing or catching and testing stderr messages from individual tests. test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call. test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it. test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it. --------- (cherry picked from commit 9d58225) Co-authored-by: Ijtaba Hussain <ijtabahussain@live.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
bedevere-bot
commented
Jul 10, 2023
GH-106605 is a backport of this pull request to the 3.12 branch. |
…ests (python#103196) Reduce test noise by fixing or catching and testing stderr messages from individual tests. test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call. test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it. test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it. --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> (cherry picked from commit 9d58225)
bedevere-bot
commented
Jul 10, 2023
GH-106606 is a backport of this pull request to the 3.11 branch. |
…H-103196) (#106605) gh-103186: Fix or catch 'extra' stderr output from unittests (GH-103196) Reduce test noise by fixing or catching and testing stderr messages from individual tests. test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call. test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it. test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it. --------- (cherry picked from commit 9d58225) Co-authored-by: Ijtaba Hussain <ijtabahussain@live.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
…103196) (#106606) Reduce test noise by fixing or catching and testing stderr messages from individual tests. test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call. test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it. test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it. --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> (cherry picked from commit 9d58225)
Reduce test noise by fixing or catching and testing stderr messages from individual tests.
test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call.
test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it.
test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it.