summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-21 17:20:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-03-22 07:04:13 -0400
commit66173dc24db5e6800483e0faddf583e80d9eb9b3 (patch)
tree290844e83b57e29f9ff20799fa0010978990bedb /tests/test_api.py
parente613a75b7c20bec00b4564f2d87812a8fd7b8e11 (diff)
downloadpython-coveragepy-git-66173dc24db5e6800483e0faddf583e80d9eb9b3.tar.gz
refactor: nice_file can be used as a function
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index e7f02738..f24beaf4 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -22,7 +22,7 @@ from coverage.files import abs_file, relative_filename
from coverage.misc import CoverageException
from tests.coveragetest import CoverageTest, TESTS_DIR, UsingModulesMixin
-from tests.helpers import assert_count_equal, change_dir
+from tests.helpers import assert_count_equal, change_dir, nice_file
class ApiTest(CoverageTest):
@@ -879,7 +879,7 @@ class SourceIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest):
assert lines['p1c'] == 0
def test_source_package_as_dir(self):
- os.chdir(self.nice_file(TESTS_DIR, 'modules'))
+ os.chdir(nice_file(TESTS_DIR, "modules"))
assert os.path.isdir("pkg1")
lines = self.coverage_usepkgs(source=["pkg1"])
self.filenames_in(lines, "p1a p1b")
@@ -905,7 +905,7 @@ class SourceIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest):
# the search for unexecuted files, and given a score of 0%.
# The omit arg is by path, so need to be in the modules directory.
- os.chdir(self.nice_file(TESTS_DIR, 'modules'))
+ os.chdir(nice_file(TESTS_DIR, "modules"))
lines = self.coverage_usepkgs(source=["pkg1"], omit=["pkg1/p1b.py"])
self.filenames_in(lines, "p1a")
self.filenames_not_in(lines, "p1b")
@@ -920,7 +920,7 @@ class SourceIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest):
def test_ambiguous_source_package_as_dir(self):
# pkg1 is a directory and a pkg, since we cd into tests/modules/ambiguous
- os.chdir(self.nice_file(TESTS_DIR, 'modules', "ambiguous"))
+ os.chdir(nice_file(TESTS_DIR, "modules", "ambiguous"))
# pkg1 defaults to directory because tests/modules/ambiguous/pkg1 exists
lines = self.coverage_usepkgs(source=["pkg1"])
self.filenames_in(lines, "ambiguous")
@@ -928,7 +928,7 @@ class SourceIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest):
def test_ambiguous_source_package_as_package(self):
# pkg1 is a directory and a pkg, since we cd into tests/modules/ambiguous
- os.chdir(self.nice_file(TESTS_DIR, 'modules', "ambiguous"))
+ os.chdir(nice_file(TESTS_DIR, "modules", "ambiguous"))
lines = self.coverage_usepkgs(source_pkgs=["pkg1"])
self.filenames_in(lines, "p1a p1b")
self.filenames_not_in(lines, "p2a p2b othera otherb osa osb ambiguous")