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
commit88f696023c9faa5105e30dc76596a2c141127a94 (patch)
tree6109a16c0205b50bf13306ea50e77a15d88645e4 /test/test_testing.py
parent1a67a1f8e08acaf6b28903ae812a7af8b40d846e (diff)
downloadpython-coveragepy-88f696023c9faa5105e30dc76596a2c141127a94.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 5a72c55..58b6dc8 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")