From df82a9638cd8fbe8a33c5969ff9c0d348d069adb Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 23 Dec 2019 15:45:39 -0500 Subject: Use abspath to rc file so that chdir doesn't bork us. #890 --- tests/test_concurrency.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 3a127499..9bfd88ca 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -493,6 +493,25 @@ class MultiprocessingTest(CoverageTest): self.assertIn("Exception during multiprocessing bootstrap init", out) self.assertIn("Exception: Crashing because called by _bootstrap", out) + def test_bug890(self): + # chdir in multiprocessing shouldn't keep us from finding the + # .coveragerc file. + self.make_file("multi.py", """\ + import multiprocessing, os, os.path + if __name__ == "__main__": + if not os.path.exists("./tmp"): os.mkdir("./tmp") + os.chdir("./tmp") + with multiprocessing.Manager(): + pass + print("ok") + """) + self.make_file(".coveragerc", """\ + [run] + concurrency = multiprocessing + """) + out = self.run_command("coverage run multi.py") + self.assertEqual(out.splitlines()[-1], "ok") + def test_coverage_stop_in_threads(): has_started_coverage = [] -- cgit v1.2.1