summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-06-30 08:59:52 (GMT)
committerGitHub <noreply@github.com>2017-06-30 08:59:52 (GMT)
commit21a0a6c9f8a047b6eb173ee59e38ad5dc3c46f86 (patch)
tree996667d7cce31a2de36dbd894138939e38346c63 /Lib/test/libregrtest
parent729780a810bbcb12b245a1b652302a601fc9f6fd (diff)
downloadcpython-21a0a6c9f8a047b6eb173ee59e38ad5dc3c46f86.zip
cpython-21a0a6c9f8a047b6eb173ee59e38ad5dc3c46f86.tar.gz
cpython-21a0a6c9f8a047b6eb173ee59e38ad5dc3c46f86.tar.bz2
threading_cleanup() failure marks test as ENV_CHANGED (#2500)
If threading_cleanup() fails to cleanup threads, set a a new support.environment_altered flag to true, flag uses by save_env which is used by regrtest to check if a test altered the environment. At the end, the test file fails with ENV_CHANGED instead of SUCCESS, to report that it altered the environment.
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/runtest.py3
-rw-r--r--Lib/test/libregrtest/save_env.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py
index fda4ca1..0210409 100644
--- a/Lib/test/libregrtest/runtest.py
+++ b/Lib/test/libregrtest/runtest.py
@@ -103,6 +103,9 @@ def runtest(ns, test):
faulthandler.dump_traceback_later(ns.timeout, exit=True)
try:
support.match_tests = ns.match_tests
+ # reset the environment_altered flag to detect if a test altered
+ # the environment
+ support.environment_altered = False
if ns.failfast:
support.failfast = True
if output_on_failure:
diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py
index 8309f26..3c45621 100644
--- a/Lib/test/libregrtest/save_env.py
+++ b/Lib/test/libregrtest/save_env.py
@@ -268,7 +268,13 @@ class saved_test_environment:
def __exit__(self, exc_type, exc_val, exc_tb):
saved_values = self.saved_values
del self.saved_values
- support.gc_collect() # Some resources use weak references
+
+ # Some resources use weak references
+ support.gc_collect()
+
+ # Read support.environment_altered, set by support helper functions
+ self.changed |= support.environment_altered
+
for name, get, restore in self.resource_info():
current = get()
original = saved_values.pop(name)