summaryrefslogtreecommitdiff
path: root/test/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-03-20 23:22:15 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-03-20 23:22:15 -0400
commitcc9534ba3869c671010f91c02e884c4da328b5ea (patch)
tree19fb2870c653b90993d9be61dc88d0f64c45a2f4 /test/test_testing.py
parent660a122bb75d77c4b1b78439230a76056d86c607 (diff)
downloadpython-coveragepy-git-cc9534ba3869c671010f91c02e884c4da328b5ea.tar.gz
make_files is more useful if it can do subdirectories too.
Diffstat (limited to 'test/test_testing.py')
-rw-r--r--test/test_testing.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
index 5a72c550..58b6dc82 100644
--- a/test/test_testing.py
+++ b/test/test_testing.py
@@ -3,6 +3,7 @@
import os, sys
sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
from backunittest import TestCase
+from coveragetest import CoverageTest
from coverage.backward import set # pylint: disable-msg=W0622
@@ -84,3 +85,21 @@ class TestingTest(TestCase):
def test_assert_false(self):
self.assertFalse(False)
self.assertRaises(AssertionError, self.assertFalse, True)
+
+
+class CoverageTestTest(CoverageTest):
+ """Test the methods in `CoverageTest`."""
+
+ def test_make_file(self):
+ # A simple file.
+ self.make_file("fooey.boo", "Hello there")
+ self.assertEqual(open("fooey.boo").read(), "Hello there")
+ # A file in a sub-directory
+ self.make_file("sub/another.txt", "Another")
+ self.assertEqual(open("sub/another.txt").read(), "Another")
+ # A second file in that sub-directory
+ self.make_file("sub/second.txt", "Second")
+ self.assertEqual(open("sub/second.txt").read(), "Second")
+ # A deeper directory
+ self.make_file("sub/deeper/evenmore/third.txt", "Third")
+ self.assertEqual(open("sub/deeper/evenmore/third.txt").read(), "Third")