blob: d1d76a33bf5be498c79e557c3891548b2d426adb [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001"Test harness for doctests."
2
3# pylint: disable-msg=E0611,W0142
4
5__metaclass__ = type
6__all__ = [
7 'additional_tests',
8 ]
9
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010import doctest
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011#from pkg_resources import (
12# resource_filename, resource_exists, resource_listdir, cleanup_resources)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
14DOCTEST_FLAGS = (
15 doctest.ELLIPSIS |
16 doctest.NORMALIZE_WHITESPACE |
17 doctest.REPORT_NDIFF)
18
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019# 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)))