summaryrefslogtreecommitdiff
path: root/tests/test_codeunit.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_codeunit.py')
-rw-r--r--tests/test_codeunit.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/test_codeunit.py b/tests/test_codeunit.py
index 3b873cd7..473bfe49 100644
--- a/tests/test_codeunit.py
+++ b/tests/test_codeunit.py
@@ -4,7 +4,7 @@ import os
import sys
from coverage.plugin import FileReporter
-from coverage.python import PythonCodeUnit
+from coverage.python import PythonFileReporter
from tests.coveragetest import CoverageTest
@@ -17,21 +17,21 @@ def native(filename):
return filename.replace("/", os.sep)
-class CodeUnitTest(CoverageTest):
- """Tests for coverage.codeunit"""
+class FileReporterTest(CoverageTest):
+ """Tests for FileReporter classes."""
run_in_temp_dir = False
def setUp(self):
- super(CodeUnitTest, self).setUp()
+ super(FileReporterTest, self).setUp()
# Parent class saves and restores sys.path, we can just modify it.
testmods = self.nice_file(os.path.dirname(__file__), 'modules')
sys.path.append(testmods)
def test_filenames(self):
- acu = PythonCodeUnit("aa/afile.py")
- bcu = PythonCodeUnit("aa/bb/bfile.py")
- ccu = PythonCodeUnit("aa/bb/cc/cfile.py")
+ acu = PythonFileReporter("aa/afile.py")
+ bcu = PythonFileReporter("aa/bb/bfile.py")
+ ccu = PythonFileReporter("aa/bb/cc/cfile.py")
self.assertEqual(acu.name, "aa/afile.py")
self.assertEqual(bcu.name, "aa/bb/bfile.py")
self.assertEqual(ccu.name, "aa/bb/cc/cfile.py")
@@ -43,9 +43,9 @@ class CodeUnitTest(CoverageTest):
self.assertEqual(ccu.source(), "# cfile.py\n")
def test_odd_filenames(self):
- acu = PythonCodeUnit("aa/afile.odd.py")
- bcu = PythonCodeUnit("aa/bb/bfile.odd.py")
- b2cu = PythonCodeUnit("aa/bb.odd/bfile.py")
+ acu = PythonFileReporter("aa/afile.odd.py")
+ bcu = PythonFileReporter("aa/bb/bfile.odd.py")
+ b2cu = PythonFileReporter("aa/bb.odd/bfile.py")
self.assertEqual(acu.name, "aa/afile.odd.py")
self.assertEqual(bcu.name, "aa/bb/bfile.odd.py")
self.assertEqual(b2cu.name, "aa/bb.odd/bfile.py")
@@ -61,9 +61,9 @@ class CodeUnitTest(CoverageTest):
import aa.bb
import aa.bb.cc
- acu = PythonCodeUnit(aa)
- bcu = PythonCodeUnit(aa.bb)
- ccu = PythonCodeUnit(aa.bb.cc)
+ acu = PythonFileReporter(aa)
+ bcu = PythonFileReporter(aa.bb)
+ ccu = PythonFileReporter(aa.bb.cc)
self.assertEqual(acu.name, native("aa.py"))
self.assertEqual(bcu.name, native("aa/bb.py"))
self.assertEqual(ccu.name, native("aa/bb/cc.py"))
@@ -79,9 +79,9 @@ class CodeUnitTest(CoverageTest):
import aa.bb.bfile
import aa.bb.cc.cfile
- acu = PythonCodeUnit(aa.afile)
- bcu = PythonCodeUnit(aa.bb.bfile)
- ccu = PythonCodeUnit(aa.bb.cc.cfile)
+ acu = PythonFileReporter(aa.afile)
+ bcu = PythonFileReporter(aa.bb.bfile)
+ ccu = PythonFileReporter(aa.bb.cc.cfile)
self.assertEqual(acu.name, native("aa/afile.py"))
self.assertEqual(bcu.name, native("aa/bb/bfile.py"))
self.assertEqual(ccu.name, native("aa/bb/cc/cfile.py"))
@@ -114,7 +114,7 @@ class CodeUnitTest(CoverageTest):
# in the path is actually the .egg zip file.
self.assert_doesnt_exist(egg1.__file__)
- ecu = PythonCodeUnit(egg1)
- eecu = PythonCodeUnit(egg1.egg1)
+ ecu = PythonFileReporter(egg1)
+ eecu = PythonFileReporter(egg1.egg1)
self.assertEqual(ecu.source(), u"")
self.assertEqual(eecu.source().split("\n")[0], u"# My egg file!")