diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-13 17:35:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 17:35:21 +0200 |
commit | 676201a59f90caace606d11d4172aa74c1cd4992 (patch) | |
tree | 50cafc224f0bebf5ecb386caea9fd518aca5b4d0 /Lib/test/libregrtest/save_env.py | |
parent | 713bb19356bce9b8f2b95461834fe1dae505f889 (diff) | |
download | cpython-git-676201a59f90caace606d11d4172aa74c1cd4992.tar.gz |
bpo-45410: regrtest replaces print_warning.orig_stderr (GH-28926)
When running Python tests with -W, runtest() now replaces
support.print_warning.orig_stderr to preserve the messages order.
Add an unit test.
Diffstat (limited to 'Lib/test/libregrtest/save_env.py')
-rw-r--r-- | Lib/test/libregrtest/save_env.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py index f0bfcf3899..60c9be2461 100644 --- a/Lib/test/libregrtest/save_env.py +++ b/Lib/test/libregrtest/save_env.py @@ -320,7 +320,8 @@ class saved_test_environment: support.environment_altered = True restore(original) if not self.quiet and not self.pgo: - print_warning(f"{name} was modified by {self.testname}") - print(f" Before: {original}\n After: {current} ", - file=sys.stderr, flush=True) + print_warning( + f"{name} was modified by {self.testname}\n" + f" Before: {original}\n" + f" After: {current} ") return False |