Ticket #3782: test_suite.2.diff

File test_suite.2.diff, 1.6 KB (added by rene.puls@…, 17 years ago)

Again, with correct white-space (spaces instead of tabs)

  • django/test/simple.py

     
    2929        app_path = app_module.__name__.split('.')[:-1]
    3030        test_module = __import__('.'.join(app_path + [TEST_MODULE]), {}, {}, TEST_MODULE)
    3131       
    32         suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_module))
    33         try:           
    34             suite.addTest(doctest.DocTestSuite(test_module,
    35                                                checker=doctestOutputChecker,
    36                                                runner=DocTestRunner))
    37         except ValueError:
    38             # No doc tests in tests.py
    39             pass
     32        # If the module has a 'suite' attribute, we assume this is a function
     33        # that returns a complete suite for this module, otherwise we build
     34        # a test suite ourselves.
     35        if hasattr(test_module, 'suite'):
     36           suite.addTest(test_module.suite())
     37        else:
     38           suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_module))
     39           try:           
     40               suite.addTest(doctest.DocTestSuite(test_module,
     41                                                  checker=doctestOutputChecker,
     42                                                  runner=DocTestRunner))
     43           except ValueError:
     44               # No doc tests in tests.py
     45               pass
    4046    except ImportError, e:
    4147        # Couldn't import tests.py. Was it due to a missing file, or
    4248        # due to an import error in a tests.py that actually exists?
Back to Top