1
0

test_sysmod.py 1.0 KB

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