1
0

test_sysmod.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import, print_function, unicode_literals
  3. import pytest
  4. from salt.ext import six
  5. from tests.support.case import ModuleCase
  6. from tests.support.helpers import slowTest
  7. @pytest.mark.windows_whitelisted
  8. class SysModuleTest(ModuleCase):
  9. """
  10. Validate the sys module
  11. """
  12. @slowTest
  13. def test_valid_docs(self):
  14. """
  15. Make sure no functions are exposed that don't have valid docstrings
  16. """
  17. ret = self.run_function("runtests_helpers.get_invalid_docs")
  18. if ret == {"missing_docstring": [], "missing_cli_example": []}:
  19. return
  20. if isinstance(ret, six.string_types):
  21. self.fail(ret)
  22. self.fail(
  23. "There are some functions which do not have a docstring or do not "
  24. "have an example:\nNo docstring:\n{0}\nNo example:\n{1}\n".format(
  25. "\n".join([" - {0}".format(f) for f in ret["missing_docstring"]]),
  26. "\n".join([" - {0}".format(f) for f in ret["missing_cli_example"]]),
  27. )
  28. )