diff options
Diffstat (limited to 'patches/22_all_tests_environment.patch')
-rw-r--r-- | patches/22_all_tests_environment.patch | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/patches/22_all_tests_environment.patch b/patches/22_all_tests_environment.patch index 6eb75f8..017bb86 100644 --- a/patches/22_all_tests_environment.patch +++ b/patches/22_all_tests_environment.patch @@ -2,7 +2,7 @@ https://bugs.python.org/issue1674555 --- Lib/site.py +++ Lib/site.py -@@ -545,8 +545,12 @@ +@@ -547,8 +547,12 @@ known_paths = venv(known_paths) if ENABLE_USER_SITE is None: ENABLE_USER_SITE = check_enableusersite() @@ -35,19 +35,16 @@ https://bugs.python.org/issue1674555 base_cmd = ([sys.executable] + support.args_from_interpreter_flags() + ['-X', 'faulthandler', '-m', 'test.regrtest']) -@@ -643,6 +643,56 @@ +@@ -643,9 +643,60 @@ support.use_resources = ns.use_resources save_modules = sys.modules.keys() -+ opt_args = support.args_from_interpreter_flags() -+ base_cmd = [sys.executable] + opt_args -+ base_cmd += ['-X', 'faulthandler', '-m', 'test.regrtest'] -+ debug_output_pat = re.compile(r"\[\d+ refs, \d+ blocks\]$") -+ + def _runtest(test, verbose, quiet, huntrleaks=False, use_resources=None, + output_on_failure=False, failfast=False, match_tests=None, + timeout=None): + if test == "test_site": ++ base_cmd = ([sys.executable] + support.args_from_interpreter_flags() + ++ ['-X', 'faulthandler', '-m', 'test.regrtest']) + slaveargs = ((test, verbose, quiet), + dict(huntrleaks=huntrleaks, + use_resources=use_resources, @@ -63,23 +60,26 @@ https://bugs.python.org/issue1674555 + stdout=PIPE, stderr=PIPE, + universal_newlines=True, + close_fds=(os.name != 'nt'), ++ cwd=support.SAVEDCWD, + env=env) + stdout, stderr = popen.communicate() + retcode = popen.wait() -+ # Strip last refcount output line if it exists, since it -+ # comes from the shutdown of the interpreter in the subcommand. -+ stderr = debug_output_pat.sub("", stderr) + stdout, _, result = stdout.strip().rpartition("\n") + if retcode != 0: -+ result = (CHILD_ERROR, "Exit code %s" % retcode) ++ result = (CHILD_ERROR, None) + else: ++ if not result: ++ return (None, None) + result = json.loads(result) ++ stdout = stdout.rstrip() ++ stderr = stderr.rstrip() + if stdout: + print(stdout) + if stderr: + print(stderr, file=sys.stderr) ++ sys.stdout.flush() ++ sys.stderr.flush() + if result[0] == INTERRUPTED: -+ assert result[1] == 'KeyboardInterrupt' + raise KeyboardInterrupt + return result + else: @@ -91,16 +91,13 @@ https://bugs.python.org/issue1674555 + def accumulate_result(test, result): ok, test_time = result - test_times.append((test_time, test)) -@@ -680,7 +730,6 @@ - print("Multiprocess option requires thread support") - sys.exit(2) - from queue import Queue -- debug_output_pat = re.compile(r"\[\d+ refs, \d+ blocks\]$") - output = Queue() - pending = MultiprocessTests(tests) - def work(): -@@ -752,15 +801,15 @@ +- test_times.append((test_time, test)) ++ if ok not in (None, CHILD_ERROR, INTERRUPTED): ++ test_times.append((test_time, test)) + if ok == PASSED: + good.append(test) + elif ok == FAILED: +@@ -752,15 +803,15 @@ if ns.trace: # If we're tracing code coverage, then we don't exit with status # if on a false return value from main. @@ -122,7 +119,7 @@ https://bugs.python.org/issue1674555 accumulate_result(test, result) except KeyboardInterrupt: interrupted = True -@@ -817,8 +866,8 @@ +@@ -815,8 +866,8 @@ sys.stdout.flush() try: ns.verbose = True @@ -133,7 +130,7 @@ https://bugs.python.org/issue1674555 except KeyboardInterrupt: # print a newline separate from the ^C print() -@@ -1239,8 +1288,9 @@ +@@ -1238,8 +1289,9 @@ for name, get, restore in self.resource_info(): current = get() original = saved_values.pop(name) |