MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_exception_handling_no_traceback

Function test_exception_handling_no_traceback

testing/test_assertion.py:1437–1466  ·  view source on GitHub ↗

Handle chain exceptions in tasks submitted by the multiprocess module (#1984).

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1435
1436
1437def test_exception_handling_no_traceback(pytester: Pytester) -> None:
1438 """Handle chain exceptions in tasks submitted by the multiprocess module (#1984)."""
1439 p1 = pytester.makepyfile(
1440 """
1441 from multiprocessing import Pool
1442
1443 def process_task(n):
1444 assert n == 10
1445
1446 def multitask_job():
1447 tasks = [1]
1448 with Pool(processes=1) as pool:
1449 pool.map(process_task, tasks)
1450
1451 def test_multitask_job():
1452 multitask_job()
1453 """
1454 )
1455 pytester.syspathinsert()
1456 result = pytester.runpytest(p1, "--tb=long")
1457 result.stdout.fnmatch_lines(
1458 [
1459 "====* FAILURES *====",
1460 "*multiprocessing.pool.RemoteTraceback:*",
1461 "Traceback (most recent call last):",
1462 "*assert n == 10",
1463 "The above exception was the direct cause of the following exception:",
1464 "> * multitask_job()",
1465 ]
1466 )
1467
1468
1469@pytest.mark.skipif("'__pypy__' in sys.builtin_module_names")

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
syspathinsertMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected