diff options
-rw-r--r-- | tests/test_process.py | 3 | ||||
-rw-r--r-- | tests/test_results.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index 02e23e72..75d420a0 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1087,7 +1087,8 @@ class ProcessCoverageMixin(object): # Find a place to put a .pth file. pth_contents = "import coverage; coverage.process_startup()\n" for pth_dir in possible_pth_dirs(): # pragma: part covered - pth_path = os.path.join(pth_dir, "subcover.pth") + worker = os.environ.get('PYTEST_XDIST_WORKER', '') + pth_path = os.path.join(pth_dir, "subcover_{0}.pth".format(worker)) with open(pth_path, "w") as pth: try: pth.write(pth_contents) diff --git a/tests/test_results.py b/tests/test_results.py index 54c2f6d7..c4d8ae5a 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -40,6 +40,8 @@ class NumbersTest(CoverageTest): self.assertAlmostEqual(n3.pc_covered, 86.666666666) def test_pc_covered_str(self): + # Numbers._precision is a global, which is bad. + Numbers.set_precision(0) n0 = Numbers(n_files=1, n_statements=1000, n_missing=0) n1 = Numbers(n_files=1, n_statements=1000, n_missing=1) n999 = Numbers(n_files=1, n_statements=1000, n_missing=999) @@ -50,7 +52,7 @@ class NumbersTest(CoverageTest): self.assertEqual(n1000.pc_covered_str, "0") def test_pc_covered_str_precision(self): - assert Numbers._precision == 0 + # Numbers._precision is a global, which is bad. Numbers.set_precision(1) n0 = Numbers(n_files=1, n_statements=10000, n_missing=0) n1 = Numbers(n_files=1, n_statements=10000, n_missing=1) |