diff options
Diffstat (limited to 'tests/test_data.py')
-rw-r--r-- | tests/test_data.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_data.py b/tests/test_data.py index 0549a3c0..9156e5a9 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -1,5 +1,8 @@ """Tests for coverage.data""" +import os +import shutil + from coverage.backward import pickle from coverage.data import CoverageData from coverage.files import PathAliases @@ -154,3 +157,29 @@ class DataTest(CoverageTest): covdata3, {'./a.py': 4, './sub/b.py': 2}, fullpath=True ) self.assert_measured_files(covdata3, ['./a.py', './sub/b.py']) + + def test_combining_from_different_directories(self): + try: + covdata1 = CoverageData() + covdata1.add_line_data(DATA_1) + os.makedirs('cov1') + covdata1.write_file('cov1/.coverage.1') + + covdata2 = CoverageData() + covdata2.add_line_data(DATA_2) + os.makedirs('cov2') + covdata2.write_file('cov2/.coverage.2') + + covdata3 = CoverageData() + covdata3.combine_parallel_data(data_dirs=[ + 'cov1/', + 'cov2/', + ]) + + self.assert_summary(covdata3, SUMMARY_1_2) + self.assert_measured_files(covdata3, MEASURED_FILES_1_2) + finally: + # Use shutil here because if something goes wrong above, these + # dirs may not be empty and os.rmdir would fail to remove them. + shutil.rmtree('cov1') + shutil.rmtree('cov2') |