Ticket #11627: test_suite.1.diff
File test_suite.1.diff, 2.4 KB (added by , 15 years ago) |
---|
-
django/test/simple.py
44 44 if hasattr(app_module, 'suite'): 45 45 suite.addTest(app_module.suite()) 46 46 else: 47 suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(app_module)) 47 suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(app_module)) 48 48 try: 49 49 suite.addTest(doctest.DocTestSuite(app_module, 50 50 checker=doctestOutputChecker, … … 82 82 if len(parts) < 2 or len(parts) > 3: 83 83 raise ValueError("Test label '%s' should be of the form app.TestCase or app.TestCase.test_method" % label) 84 84 85 app_module = get_app(parts[0])86 TestClass = getattr( app_module, parts[1], None)85 module = get_app(parts[0]) 86 TestClass = getattr(module, parts[1], None) 87 87 88 88 # Couldn't find the test class in models.py; look in tests.py 89 89 if TestClass is None: 90 test_module = get_tests(app_module)91 if test_module:92 TestClass = getattr( test_module, parts[1], None)90 module = get_tests(module) 91 if module: 92 TestClass = getattr(module, parts[1], None) 93 93 94 94 if len(parts) == 2: # label is app.TestClass 95 95 try: 96 return unittest.TestLoader().loadTestsFromTestCase(TestClass) 96 # retrieves tests from either a TestCase or TestSuite 97 return unittest.TestLoader().loadTestsFromName(parts[1], module) 97 98 except TypeError: 98 99 raise ValueError("Test label '%s' does not refer to a test class" % label) 99 100 else: # label is app.TestClass.test_method -
django/test/testcases.py
460 460 transaction.rollback() 461 461 transaction.leave_transaction_management() 462 462 connection.close() 463 464 class TestSuite(unittest.TestSuite): 465 pass -
django/test/__init__.py
3 3 """ 4 4 5 5 from django.test.client import Client 6 from django.test.testcases import TestCase, TransactionTestCase 6 from django.test.testcases import TestCase, TransactionTestCase, TestSuite