1
0

test_sysmod.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # Import python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. # Import Salt Testing libs
  5. from tests.support.case import ModuleCase
  6. from salt.ext import six
  7. import pytest
  8. @pytest.mark.windows_whitelisted
  9. class SysModuleTest(ModuleCase):
  10. '''
  11. Validate the sys module
  12. '''
  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. )