Changeset 284 for trunk/test/suite.py

Show
Ignore:
Timestamp:
11/24/08 12:41:22 (20 months ago)
Author:
akaihola
Message:

[test] Refactored build_for_doctests()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/test/suite.py

    r267 r284  
    33from ambidjangolib.test.simple import DocTestRunner 
    44 
    5 def build_doctest_suite(module): 
    6     return doctest.DocTestSuite(module, 
    7                                 checker=doctestOutputChecker, 
    8                                 runner=DocTestRunner, 
    9                                 optionflags=doctest.REPORT_ONLY_FIRST_FAILURE) 
    10  
    115def build_for_doctests(*module_paths, **kwargs): 
     6    kwargs.setdefault('checker', doctestOutputChecker) 
     7    kwargs.setdefault('runner', DocTestRunner) 
     8    kwargs.setdefault('optionflags', doctest.REPORT_ONLY_FIRST_FAILURE) 
    129    def suite_func(): 
    1310        suite = TestSuite() 
     
    1613            for submodule_name in module_path.split('.')[1:]: 
    1714                module = getattr(module, submodule_name) 
    18             suite.addTest(build_doctest_suite(module)) 
     15            suite.addTest(doctest.DocTestSuite(module, **kwargs)) 
    1916        return suite 
    2017    return suite_func