test_docs.py 1.0 KB

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