diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_api.py | 2 | ||||
-rw-r--r-- | tests/test_cmdline.py | 10 | ||||
-rw-r--r-- | tests/test_process.py | 22 |
3 files changed, 28 insertions, 6 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index f8b7b4b2..62fd9ebc 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -442,7 +442,7 @@ class ApiTest(CoverageTest): cov2 = coverage.Coverage() with self.assertRaisesRegex(CoverageException, r"No data to combine"): - cov2.combine(strict=True) + cov2.combine(strict=True, keep=False) cov3 = coverage.Coverage() cov3.combine() diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 374adb0d..3b11881b 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -218,20 +218,20 @@ class CmdLineTest(BaseCmdLineTest): # coverage combine with args self.cmd_executes("combine datadir1", """\ cov = Coverage() - cov.combine(["datadir1"], strict=True) + cov.combine(["datadir1"], strict=True, keep=False) cov.save() """) # coverage combine, appending self.cmd_executes("combine --append datadir1", """\ cov = Coverage() cov.load() - cov.combine(["datadir1"], strict=True) + cov.combine(["datadir1"], strict=True, keep=False) cov.save() """) # coverage combine without args self.cmd_executes("combine", """\ cov = Coverage() - cov.combine(None, strict=True) + cov.combine(None, strict=True, keep=False) cov.save() """) @@ -239,12 +239,12 @@ class CmdLineTest(BaseCmdLineTest): # https://github.com/nedbat/coveragepy/issues/385 self.cmd_executes("combine --rcfile cov.ini", """\ cov = Coverage(config_file='cov.ini') - cov.combine(None, strict=True) + cov.combine(None, strict=True, keep=False) cov.save() """) self.cmd_executes("combine --rcfile cov.ini data1 data2/more", """\ cov = Coverage(config_file='cov.ini') - cov.combine(["data1", "data2/more"], strict=True) + cov.combine(["data1", "data2/more"], strict=True, keep=False) cov.save() """) diff --git a/tests/test_process.py b/tests/test_process.py index e4886156..b44147a3 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -244,6 +244,28 @@ class ProcessTest(CoverageTest): data.read() self.assertEqual(line_counts(data)['b_or_c.py'], 7) + def test_combine_parallel_data_keep(self): + self.make_b_or_c_py() + out = self.run_command("coverage run -p b_or_c.py b") + self.assertEqual(out, 'done\n') + self.assert_doesnt_exist(".coverage") + self.assert_file_count(".coverage.*", 1) + + out = self.run_command("coverage run -p b_or_c.py c") + self.assertEqual(out, 'done\n') + self.assert_doesnt_exist(".coverage") + + # After two -p runs, there should be two .coverage.machine.123 files. + self.assert_file_count(".coverage.*", 2) + + # Combine the parallel coverage data files into .coverage with the keep flag. + self.run_command("coverage combine --keep") + + # After combining, the .coverage file & the original combined file should still be there. + self.assert_exists(".coverage") + self.assert_file_count(".coverage.*", 2) + + def test_append_data(self): self.make_b_or_c_py() |