Skip to content
Snippets Groups Projects
Commit 8776b3c2 authored by Savici, Andrei T.'s avatar Savici, Andrei T. Committed by GitHub
Browse files

Merge pull request #20841 from mantidproject/20839_add_info_to_error_in_doctest

Raise exception if no test code in doctest
parents 36dc7249 f466afec
No related branches found
No related tags found
No related merge requests found
......@@ -140,6 +140,11 @@ TEST_FAILURE_TYPE = "UsageFailure"
# Package name
PACKAGE_NAME = "docs"
# No Test found error message
NO_TEST_ERROR = "\n*************************************************\n"\
"* No test code has been found in given file(s). * \n"\
"*************************************************"
#-------------------------------------------------------------------------------
# Define parts of lines that denote a document
DOCTEST_DOCUMENT_BEGIN = "Document:"
......@@ -283,7 +288,10 @@ class DocTestOutputParser(object):
continue
if line.startswith(DOCTEST_SUMMARY_TITLE): # end of tests
in_doc = False
cases.extend(self.__parse_document(document_txt))
if document_txt:
cases.extend(self.__parse_document(document_txt))
else:
raise RuntimeError(NO_TEST_ERROR)
document_txt = None
if in_doc and line != "":
document_txt.append(line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment