Merged revisions 80974 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80974 | michael.foord | 2010-05-08 15:20:07 +0200 (Sat, 08 May 2010) | 1 line

  Issue 7780. Adding a test for unittest test discovery from a dotted path.
........
This commit is contained in:
Michael Foord 2010-05-08 13:23:31 +00:00
parent 099e45674c
commit 161b024b6d
1 changed files with 17 additions and 0 deletions

View File

@ -337,5 +337,22 @@ class TestDiscovery(unittest.TestCase):
self.assertEqual(sys.path[0], full_path) 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__': if __name__ == '__main__':
unittest.main() unittest.main()