MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_worker_output_on_failure

Method test_worker_output_on_failure

Lib/test/test_regrtest.py:2270–2302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2268 @unittest.skipIf(support.is_android,
2269 'raising SIGSEGV on Android is unreliable')
2270 def test_worker_output_on_failure(self):
2271 # Skip test if faulthandler is missing
2272 import_helper.import_module('faulthandler')
2273
2274 code = textwrap.dedent(r"""
2275 import faulthandler
2276 import unittest
2277 from test import support
2278
2279 class CrashTests(unittest.TestCase):
2280 def test_crash(self):
2281 print("just before crash!", flush=True)
2282
2283 with support.SuppressCrashReport():
2284 faulthandler._sigsegv(True)
2285 """)
2286 testname = self.create_test(code=code)
2287
2288 # Sanitizers must not handle SIGSEGV (ex: for test_enable_fd())
2289 env = dict(os.environ)
2290 option = 'handle_segv=0'
2291 support.set_sanitizer_env_var(env, option)
2292
2293 output = self.run_tests("-j1", testname,
2294 exitcode=EXITCODE_BAD_TEST,
2295 env=env)
2296 self.check_executed_tests(output, testname,
2297 failed=[testname],
2298 stats=0, parallel=True)
2299 if not support.MS_WINDOWS:
2300 exitcode = -int(signal.SIGSEGV)
2301 self.assertIn(f"Exit code {exitcode} (SIGSEGV)", output)
2302 self.check_line(output, "just before crash!", full=True, regex=False)
2303
2304 def test_verbose3(self):
2305 code = textwrap.dedent(r"""

Callers

nothing calls this directly

Calls 7

run_testsMethod · 0.95
dedentMethod · 0.80
create_testMethod · 0.80
check_executed_testsMethod · 0.80
assertInMethod · 0.80
check_lineMethod · 0.80
import_moduleMethod · 0.45

Tested by

no test coverage detected