Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | "Test harness for doctests." |
| 2 | |
| 3 | # pylint: disable-msg=E0611,W0142 |
| 4 | |
| 5 | __metaclass__ = type |
| 6 | __all__ = [ |
| 7 | 'additional_tests', |
| 8 | ] |
| 9 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | import doctest |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | #from pkg_resources import ( |
| 12 | # resource_filename, resource_exists, resource_listdir, cleanup_resources) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | |
| 14 | DOCTEST_FLAGS = ( |
| 15 | doctest.ELLIPSIS | |
| 16 | doctest.NORMALIZE_WHITESPACE | |
| 17 | doctest.REPORT_NDIFF) |
| 18 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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))) |