Changeset 6735 for main/waeup.sirp/trunk
- Timestamp:
- 13 Sep 2011, 08:55:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/testing.py
r6727 r6735 6 6 import os.path 7 7 import re 8 import unittest 8 9 import warnings 9 10 import zope.component … … 332 333 remove_new_loggers(self.old_loggers) 333 334 return 335 336 def get_doctest_suite(filename_list=[]): 337 """Helper function to create doctest suites for doctests. 338 339 The `filename_list` is a list of filenames relative to the 340 w.s. dir. So, to get a doctest suite for ``browser.txt`` and 341 ``blah.txt`` in the ``browser/`` subpackage you have to pass 342 ``filename_list=['browser/browser.txt','browser/blah.txt']`` and 343 so on. 344 345 The returned test suite must be registered somewhere locally for 346 instance by something like: 347 348 from waeup.sirp.testing import get_doctest_suite 349 def test_suite(): 350 suite = get_doctest_suite(['mypkg/foo.txt', 'mypkg/bar.txt']) 351 return suite 352 353 and that's it. 354 """ 355 suite = unittest.TestSuite() 356 for filename in filename_list: 357 path = os.path.join( 358 os.path.dirname(__file__), filename) 359 test = doctest.DocFileSuite( 360 path, 361 module_relative=False, 362 setUp=setUp, tearDown=tearDown, 363 globs = dict(getRootFolder = getRootFolder), 364 optionflags = doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE, 365 checker = checker, 366 ) 367 test.layer = FunctionalLayer 368 suite.addTest(test) 369 return suite
Note: See TracChangeset for help on using the changeset viewer.