diff -r bda5a87df1c8 Lib/test/test_capi.py --- a/Lib/test/test_capi.py Fri Sep 13 06:27:52 2013 -0700 +++ b/Lib/test/test_capi.py Fri Sep 13 08:48:02 2013 -0700 @@ -44,12 +44,13 @@ @unittest.skipUnless(threading, 'Threading required for this test.') def test_no_FatalError_infinite_loop(self): - with support.suppress_crash_popup(): - p = subprocess.Popen([sys.executable, "-c", - 'import _testcapi;' - '_testcapi.crash_no_current_thread()'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + with support.SuppressCoreFiles(): + with support.suppress_crash_popup(): + p = subprocess.Popen([sys.executable, "-c", + 'import _testcapi;' + '_testcapi.crash_no_current_thread()'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. diff -r bda5a87df1c8 Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py Fri Sep 13 06:27:52 2013 -0700 +++ b/Lib/test/test_faulthandler.py Fri Sep 13 08:48:02 2013 -0700 @@ -19,18 +19,6 @@ TIMEOUT = 0.5 -try: - from resource import setrlimit, RLIMIT_CORE, error as resource_error -except ImportError: - prepare_subprocess = None -else: - def prepare_subprocess(): - # don't create core file - try: - setrlimit(RLIMIT_CORE, (0, 0)) - except (ValueError, resource_error): - pass - def expected_traceback(lineno1, lineno2, header, min_count=1): regex = header regex += ' File "", line %s in func\n' % lineno1 @@ -59,10 +47,8 @@ build, and replace "Current thread 0x00007f8d8fbd9700" by "Current thread XXX". """ - options = {} - if prepare_subprocess: - options['preexec_fn'] = prepare_subprocess - process = script_helper.spawn_python('-c', code, **options) + with support.SuppressCoreFiles(): + process = script_helper.spawn_python('-c', code) stdout, stderr = process.communicate() exitcode = process.wait() output = support.strip_python_stderr(stdout) @@ -101,8 +87,9 @@ header=re.escape(header)) if other_regex: regex += '|' + other_regex - with support.suppress_crash_popup(): - output, exitcode = self.get_output(code, filename) + with support.SuppressCoreFiles(): + with support.suppress_crash_popup(): + output, exitcode = self.get_output(code, filename) output = '\n'.join(output) self.assertRegex(output, regex) self.assertNotEqual(exitcode, 0) @@ -232,8 +219,9 @@ faulthandler._sigsegv() """.strip() not_expected = 'Fatal Python error' - with support.suppress_crash_popup(): - stderr, exitcode = self.get_output(code) + with support.SuppressCoreFiles(): + with support.suppress_crash_popup(): + stderr, exitcode = self.get_output(code) stder = '\n'.join(stderr) self.assertTrue(not_expected not in stderr, "%r is present in %r" % (not_expected, stderr)) diff -r bda5a87df1c8 Lib/test/test_sys.py --- a/Lib/test/test_sys.py Fri Sep 13 06:27:52 2013 -0700 +++ b/Lib/test/test_sys.py Fri Sep 13 08:48:02 2013 -0700 @@ -250,15 +250,16 @@ sys.setrecursionlimit(%d) f()""") - with test.support.suppress_crash_popup(): - for i in (50, 1000): - sub = subprocess.Popen([sys.executable, '-c', code % i], - stderr=subprocess.PIPE) - err = sub.communicate()[1] - self.assertTrue(sub.returncode, sub.returncode) - self.assertIn( - b"Fatal Python error: Cannot recover from stack overflow", - err) + with test.support.SuppressCoreFiles(): + with test.support.suppress_crash_popup(): + for i in (50, 1000): + sub = subprocess.Popen([sys.executable, '-c', code % i], + stderr=subprocess.PIPE) + err = sub.communicate()[1] + self.assertTrue(sub.returncode, sub.returncode) + self.assertIn( + b"Fatal Python error: Cannot recover from stack overflow", + err) def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute diff -r bda5a87df1c8 Lib/test/test_threading.py --- a/Lib/test/test_threading.py Fri Sep 13 06:27:52 2013 -0700 +++ b/Lib/test/test_threading.py Fri Sep 13 08:48:02 2013 -0700 @@ -839,7 +839,8 @@ _testcapi.run_in_subinterp(%r) """ % (subinterp_code,) - rc, out, err = assert_python_failure("-c", script) + with test.support.SuppressCoreFiles(): + rc, out, err = assert_python_failure("-c", script) self.assertIn("Fatal Python error: Py_EndInterpreter: " "not the last thread", err.decode())