[Python-checkins] r80974 - python/trunk/Lib/unittest/test/test_discovery.py
michael.foord
python-checkins at python.org
Sat May 8 15:20:07 CEST 2010
Author: michael.foord
Date: Sat May 8 15:20:07 2010
New Revision: 80974
Log:
Issue 7780. Adding a test for unittest test discovery from a dotted path.
Modified:
python/trunk/Lib/unittest/test/test_discovery.py
Modified: python/trunk/Lib/unittest/test/test_discovery.py
==============================================================================
--- python/trunk/Lib/unittest/test/test_discovery.py (original)
+++ python/trunk/Lib/unittest/test/test_discovery.py Sat May 8 15:20:07 2010
@@ -341,5 +341,22 @@
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()
More information about the Python-checkins
mailing list