1"Test harness for doctests." 2 3# pylint: disable-msg=E0611,W0142 4 5__metaclass__ = type 6__all__ = [ 7 'additional_tests', 8 ] 9 10import doctest 11#from pkg_resources import ( 12# resource_filename, resource_exists, resource_listdir, cleanup_resources) 13 14DOCTEST_FLAGS = ( 15 doctest.ELLIPSIS | 16 doctest.NORMALIZE_WHITESPACE | 17 doctest.REPORT_NDIFF) 18 19# def additional_tests(): 20# "Run the doc tests (README.txt and docs/*, if any exist)" 21# doctest_files = [ 22# os.path.abspath(resource_filename('bs4', 'README.txt'))] 23# if resource_exists('bs4', 'docs'): 24# for name in resource_listdir('bs4', 'docs'): 25# if name.endswith('.txt'): 26# doctest_files.append( 27# os.path.abspath( 28# resource_filename('bs4', 'docs/%s' % name))) 29# kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS) 30# atexit.register(cleanup_resources) 31# return unittest.TestSuite(( 32# doctest.DocFileSuite(*doctest_files, **kwargs))) 33