summaryrefslogtreecommitdiff
path: root/test/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-08-23 22:51:36 -0400
committerNed Batchelder <ned@nedbatchelder.com>2011-08-23 22:51:36 -0400
commitf408a8834b0be15d7ecb11e2f491106da12629a1 (patch)
treec9c1e2ac7df597033839c69b6a2dd9e0e1d3790f /test/test_process.py
parent9b1f4aa3fdca6876ec95b7fb74be8f4a02abb300 (diff)
downloadpython-coveragepy-git-f408a8834b0be15d7ecb11e2f491106da12629a1.tar.gz
Finished implementation of path aliases for combining data files. #17.
Diffstat (limited to 'test/test_process.py')
-rw-r--r--test/test_process.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/test_process.py b/test/test_process.py
index 1bdb1400..5b576d1f 100644
--- a/test/test_process.py
+++ b/test/test_process.py
@@ -129,6 +129,52 @@ class ProcessTest(CoverageTest):
b_or_c 7 0 100%
"""))
+ def test_combine_with_aliases(self):
+ self.make_file("d1/x.py", """\
+ a = 1
+ b = 2
+ print("%s %s" % (a, b))
+ """)
+
+ self.make_file("d2/x.py", """\
+ # 1
+ # 2
+ # 3
+ c = 4
+ d = 5
+ print("%s %s" % (c, d))
+ """)
+
+ self.make_file(".coveragerc", """\
+ [run]
+ parallel = True
+
+ [paths]
+ source =
+ src
+ */d1
+ */d2
+ """)
+
+ out = self.run_command("coverage run " + os.path.normpath("d1/x.py"))
+ self.assertEqual(out, '1 2\n')
+ out = self.run_command("coverage run " + os.path.normpath("d2/x.py"))
+ self.assertEqual(out, '4 5\n')
+
+ self.assertEqual(self.number_of_data_files(), 2)
+
+ self.run_command("coverage combine")
+ self.assert_exists(".coverage")
+
+ # After combining, there should be only the .coverage file.
+ self.assertEqual(self.number_of_data_files(), 1)
+
+ # Read the coverage data file and see that the two different x.py
+ # files have been combined together.
+ data = coverage.CoverageData()
+ data.read_file(".coverage")
+ self.assertEqual(data.summary(fullpath=True), {'src/x.py': 6})
+
def test_missing_source_file(self):
# Check what happens if the source is missing when reporting happens.
self.make_file("fleeting.py", """\