Adding a test for unittest test discovery with dotted path name.

This commit is contained in:
Michael Foord 2010-05-07 15:34:08 +00:00
parent d1e696b60f
commit 215d394b82
2 changed files with 21 additions and 4 deletions

View file

@ -1,10 +1,27 @@
from cStringIO import StringIO
import os
import unittest
class Test_TestProgram(unittest.TestCase):
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)
# Horrible white box test
def testNoExit(self):
result = object()