diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-23 15:44:36 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-23 18:01:49 -0500 |
commit | 7fb6fc15d88778f15a49ab1e63bdf550c2c7c981 (patch) | |
tree | a4985bf25d77981e8894e15a8bbe4f2f49fdde79 /tests/test_concurrency.py | |
parent | 42a651c6e23b4156c5bc37208d97d0788e09edf7 (diff) | |
download | python-coveragepy-git-7fb6fc15d88778f15a49ab1e63bdf550c2c7c981.tar.gz |
Catch and display expceptions during multiprocessing bootstrap.
Diffstat (limited to 'tests/test_concurrency.py')
-rw-r--r-- | tests/test_concurrency.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 436df803..3a127499 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -476,6 +476,23 @@ class MultiprocessingTest(CoverageTest): expected_out = "{nprocs} pids, total = {total}".format(nprocs=nprocs, total=total) self.try_multiprocessing_code_with_branching(code, expected_out) + def test_multiprocessing_bootstrap_error_handling(self): + # An exception during bootstrapping will be reported. + self.make_file("multi.py", """\ + import multiprocessing + if __name__ == "__main__": + with multiprocessing.Manager(): + pass + """) + self.make_file(".coveragerc", """\ + [run] + concurrency = multiprocessing + _crash = _bootstrap + """) + out = self.run_command("coverage run multi.py") + self.assertIn("Exception during multiprocessing bootstrap init", out) + self.assertIn("Exception: Crashing because called by _bootstrap", out) + def test_coverage_stop_in_threads(): has_started_coverage = [] |