Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
doxec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frank Sauerburger
doxec
Commits
7c74b500
There was a problem fetching the pipeline metadata.
Commit
7c74b500
authored
7 years ago
by
Frank Sauerburger
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug/return_code' into 'master'
Bug/return code Closes
#4
See merge request
!1
parents
52cb6d28
0aeddf1e
No related branches found
Branches containing commit
Tags
v0.1.1
Tags containing commit
1 merge request
!1
Bug/return code
Pipeline
#
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/doxec
+12
-1
12 additions, 1 deletion
bin/doxec
doxec/__init__.py
+7
-0
7 additions, 0 deletions
doxec/__init__.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
20 additions
and
2 deletions
bin/doxec
+
12
−
1
View file @
7c74b500
...
...
@@ -2,6 +2,7 @@
import
argparse
import
doxec
import
sys
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
...
...
@@ -14,12 +15,19 @@ if __name__ == "__main__":
default
=
"
markdown
"
,
help
=
"
The syntax parser to be used for the listed files.
"
)
parser
.
add_argument
(
"
--version
"
,
action
=
"
store_true
"
,
help
=
"
Prints the version of the doxec package and exits.
"
)
parser
.
add_argument
(
"
documents
"
,
metavar
=
"
DOCUMENT
"
,
nargs
=
"
+
"
,
default
=
[],
help
=
"
A document from which the code examples should be parsed and
"
"
executed
"
)
args
=
parser
.
parse_args
()
if
args
.
version
:
print
(
"
Doxec package version: %s
"
%
doxec
.
__version__
)
sys
.
exit
(
0
)
parser
=
doxec
.
parser
[
args
.
syntax
]
def
monitor
(
op
,
exception
):
...
...
@@ -29,6 +37,9 @@ if __name__ == "__main__":
print
(
exception
,
end
=
""
)
print
(
chr
(
27
)
+
"
[0m
"
)
fail_count
=
0
for
doc_path
in
args
.
documents
:
doc
=
doxec
.
Document
(
doc_path
,
syntax
=
parser
)
doc
.
run
(
monitor
=
monitor
)
fail_count
+=
not
doc
.
run
(
monitor
=
monitor
)
sys
.
exit
(
fail_count
)
This diff is collapsed.
Click to expand it.
doxec/__init__.py
+
7
−
0
View file @
7c74b500
...
...
@@ -3,6 +3,8 @@ import abc
import
re
import
subprocess
__version__
=
"
0.1.1
"
class
TestException
(
Exception
):
"""
This exception should be raised, if an operation performed tests and one
...
...
@@ -310,11 +312,15 @@ class Document:
is called after every iteration. The first argument of monitor is the
operation object, the second argument is None or the exception that
occurred.
The method returns True on success.
"""
success
=
True
for
op
in
self
.
operations
:
try
:
op
.
execute
()
except
TestException
as
e
:
success
=
False
if
callable
(
monitor
):
monitor
(
op
,
e
)
else
:
...
...
@@ -322,3 +328,4 @@ class Document:
else
:
if
callable
(
monitor
):
monitor
(
op
,
None
)
return
success
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
7c74b500
...
...
@@ -5,7 +5,7 @@ from setuptools import setup
setup
(
name
=
"
doxec
"
,
version
=
"
0.1.
0
"
,
version
=
"
0.1.
1
"
,
author
=
"
Frank Sauerburger
"
,
author_email
=
"
frank@sauerburger.com
"
,
description
=
(
"
Run documentation and test whether the examples work.
"
),
...
...
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