Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
97632273
Commit
97632273
authored
7 years ago
by
Elliot Oram
Browse files
Options
Downloads
Patches
Plain Diff
Raise exception if no test code in doctest
Refs #20839
parent
45964c3b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/sphinxext/mantiddoc/doctest.py
+10
-1
10 additions, 1 deletion
docs/sphinxext/mantiddoc/doctest.py
with
10 additions
and
1 deletion
docs/sphinxext/mantiddoc/doctest.py
+
10
−
1
View file @
97632273
...
...
@@ -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
)
...
...
@@ -302,6 +310,7 @@ class DocTestOutputParser(object):
list: List of test cases in the document
"""
fullname
=
self
.
__extract_fullname
(
results
[
0
])
if
not
results
[
1
].
startswith
(
"
-
"
):
raise
ValueError
(
"
Invalid second line of output:
'
%s
'
.
"
\
"
Expected a title underline.
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment