def test_format_docstrings(): """ Test if docstrings are well formated. """ format_infractions = [] for path in list_files(".py"): rel_path = os.path.relpath(path, pylearn2.__path__[0]) if rel_path in whitelist_docstrings: continue try: format_infractions.extend(docstring_errors(path)) except StandardError as e: format_infractions.append(["%s failed to run so format cannot " "be checked. Error message:\n %s" % (rel_path, e)]) if len(format_infractions) > 0: msg = "\n".join(':'.join(line) for line in format_infractions) raise AssertionError("Docstring format not respected:\n%s" % msg)
def verify_format_docstrings(): """ Implementation of `test_format_docstrings`. The implementation is factored out so it can be placed inside a guard against SkipTest. """ format_infractions = [] for path in list_files(".py"): rel_path = os.path.relpath(path, pylearn2.__path__[0]) if rel_path in whitelist_docstrings: continue try: format_infractions.extend(docstring_errors(path)) except StandardError as e: format_infractions.append(["%s failed to run so format cannot " "be checked. Error message:\n %s" % (rel_path, e)]) if len(format_infractions) > 0: msg = "\n".join(':'.join(line) for line in format_infractions) raise AssertionError("Docstring format not respected:\n%s" % msg)
def verify_format_docstrings(): """ Implementation of `test_format_docstrings`. The implementation is factored out so it can be placed inside a guard against SkipTest. """ format_infractions = [] for path in list_files(".py"): rel_path = os.path.relpath(path, pylearn2.__path__[0]) if rel_path in whitelist_docstrings: continue try: format_infractions.extend(docstring_errors(path)) except Exception as e: format_infractions.append(["%s failed to run so format cannot " "be checked. Error message:\n %s" % (rel_path, e)]) if len(format_infractions) > 0: msg = "\n".join(':'.join(line) for line in format_infractions) raise AssertionError("Docstring format not respected:\n%s" % msg)