diff options
Diffstat (limited to 'Lib/unittest/test/test_discovery.py')
-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 ad86a42..aa16b17 100644 --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -337,5 +337,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() |