diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-05-08 13:20:07 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-05-08 13:20:07 (GMT) |
commit | 22097e4e663f60bcf486bfc65ea9ba9b3059ae03 (patch) | |
tree | 66f76e55dace19c4c1f05fe79243241692b3d52b /Lib | |
parent | cbf54b1e7ea9e2b37a2385385f16196fe3943ca8 (diff) | |
download | cpython-22097e4e663f60bcf486bfc65ea9ba9b3059ae03.zip cpython-22097e4e663f60bcf486bfc65ea9ba9b3059ae03.tar.gz cpython-22097e4e663f60bcf486bfc65ea9ba9b3059ae03.tar.bz2 |
Issue 7780. Adding a test for unittest test discovery from a dotted path.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/unittest/test/test_discovery.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py index 1f8b5c2..1155de1 100644 --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -341,5 +341,22 @@ class TestDiscovery(unittest.TestCase): self.assertEqual(sys.path[0], full_path) + def test_discovery_from_dotted_path(self): + loader = unittest.TestLoader() + + tests = [self] + expectedPath = os.path.abspath(os.path.dirname(unittest.test.__file__)) + + self.wasRun = False + def _find_tests(start_dir, pattern): + self.wasRun = True + self.assertEqual(start_dir, expectedPath) + return tests + loader._find_tests = _find_tests + suite = loader.discover('unittest.test') + self.assertTrue(self.wasRun) + self.assertEqual(suite._tests, tests) + + if __name__ == '__main__': unittest.main() |