test_sysmod.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. @pytest.mark.windows_whitelisted
  7. class SysModuleTest(ModuleCase):
  8. """
  9. Validate the sys module
  10. """
  11. @pytest.mark.slow_test(seconds=30) # Test takes >10 and <=30 seconds
  12. def test_valid_docs(self):
  13. """
  14. Make sure no functions are exposed that don't have valid docstrings
  15. """
  16. ret = self.run_function("runtests_helpers.get_invalid_docs")
  17. if ret == {"missing_docstring": [], "missing_cli_example": []}:
  18. return
  19. if isinstance(ret, six.string_types):
  20. self.fail(ret)
  21. self.fail(
  22. "There are some functions which do not have a docstring or do not "
  23. "have an example:\nNo docstring:\n{0}\nNo example:\n{1}\n".format(
  24. "\n".join([" - {0}".format(f) for f in ret["missing_docstring"]]),
  25. "\n".join([" - {0}".format(f) for f in ret["missing_cli_example"]]),
  26. )
  27. )