summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-15 06:47:37 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-15 06:47:37 -0400
commit624ef0d0662d27fc3c95b2820c98bad5d69f2270 (patch)
treec0840c9226db42c301ffad13d76884029374870d
parent9ac9f055de890a9f4cc8be0c0a3cc00f9be31d11 (diff)
downloadpython-coveragepy-git-624ef0d0662d27fc3c95b2820c98bad5d69f2270.tar.gz
Use ntpath so Windows file manipulation can be tested the same everywhere.
-rw-r--r--coverage/files.py2
-rw-r--r--tests/test_files.py2
-rw-r--r--tests/test_process.py8
3 files changed, 4 insertions, 8 deletions
diff --git a/coverage/files.py b/coverage/files.py
index d2742a39..1b6f6281 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -77,7 +77,7 @@ def flat_rootname(filename):
For example, the file a/b/c.py will return 'a_b_c_py'
"""
- name = os.path.splitdrive(filename)[1]
+ name = ntpath.splitdrive(filename)[1]
return re.sub(r"[\\/.:]", "_", name)
diff --git a/tests/test_files.py b/tests/test_files.py
index 813f8612..e3d33285 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -56,7 +56,7 @@ class FilesTest(CoverageTest):
def test_flat_rootname(self):
self.assertEqual(flat_rootname("a/b/c.py"), "a_b_c_py")
- self.assertEqual(flat_rootname(r"c:\foo\bar.html"), "c__foo_bar_html")
+ self.assertEqual(flat_rootname(r"c:\foo\bar.html"), "_foo_bar_html")
class MatcherTest(CoverageTest):
diff --git a/tests/test_process.py b/tests/test_process.py
index 9bd72119..3023a18c 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -890,9 +890,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
def test_subprocess_with_pth_files(self): # pragma: not covered
if env.METACOV:
- self.skip(
- "Can't test sub-process pth file suppport during metacoverage"
- )
+ self.skip("Can't test sub-process pth file suppport during metacoverage")
# Main will run sub.py
self.make_file("main.py", """\
@@ -954,9 +952,7 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
"""
if env.METACOV:
- self.skip(
- "Can't test sub-process pth file suppport during metacoverage"
- )
+ self.skip("Can't test sub-process pth file suppport during metacoverage")
def fullname(modname):
"""What is the full module name for `modname` for this test?"""