summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-01-07 21:56:54 -0500
committerNed Batchelder <ned@nedbatchelder.com>2020-01-07 21:56:54 -0500
commitd402b4600df571b7bbeaa614d1c84110e700896c (patch)
tree2ff0efd16bd99d48706a6d85b74f548390270491
parenta4cda16450536e5b2cc3aa4d0e93a01fcc34318e (diff)
downloadpython-coveragepy-git-d402b4600df571b7bbeaa614d1c84110e700896c.tar.gz
A test replicating #916
-rw-r--r--tests/test_api.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 7e43a6bb..8ab57955 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -998,7 +998,7 @@ class TestRunnerPluginTest(CoverageTest):
way they do.
"""
- def pretend_to_be_nose_with_cover(self, erase):
+ def pretend_to_be_nose_with_cover(self, erase=False, cd=False):
"""This is what the nose --with-cover plugin does."""
self.make_file("no_biggie.py", """\
a = 1
@@ -1006,6 +1006,7 @@ class TestRunnerPluginTest(CoverageTest):
if b == 1:
c = 4
""")
+ self.make_file("sub/hold.txt", "")
cov = coverage.Coverage()
if erase:
@@ -1013,6 +1014,8 @@ class TestRunnerPluginTest(CoverageTest):
cov.erase()
cov.load()
self.start_import_stop(cov, "no_biggie")
+ if cd:
+ os.chdir("sub")
cov.combine()
cov.save()
cov.report(["no_biggie.py"], show_missing=True)
@@ -1021,13 +1024,19 @@ class TestRunnerPluginTest(CoverageTest):
--------------------------------------------
no_biggie.py 4 1 75% 4
"""))
+ if cd:
+ os.chdir("..")
def test_nose_plugin(self):
- self.pretend_to_be_nose_with_cover(erase=False)
+ self.pretend_to_be_nose_with_cover()
def test_nose_plugin_with_erase(self):
self.pretend_to_be_nose_with_cover(erase=True)
+ def test_nose_plugin_with_cd(self):
+ # https://github.com/nedbat/coveragepy/issues/916
+ self.pretend_to_be_nose_with_cover(cd=True)
+
def pretend_to_be_pytestcov(self, append):
"""Act like pytest-cov."""
self.make_file("prog.py", """\