test_docs.py 1.1 KB

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