Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-pull-mirror-test
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
heptapod
Testing Projects
hg-pull-mirror-test
Commits
1d80cda7fe93
Commit
1d80cda7fe93
authored
4 years ago
by
Anton Shestakov
Browse files
Options
Downloads
Patches
Plain Diff
test2rst: minor improvements
parent
5affbb44f135
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/test2rst.py
+12
-9
12 additions, 9 deletions
docs/test2rst.py
with
12 additions
and
9 deletions
docs/test2rst.py
+
12
−
9
View file @
1d80cda7
#!/usr/bin/env python3
import
argparse
import
os
import
re
...
...
@@ -3,6 +4,5 @@
import
os
import
re
import
sys
ignored_patterns
=
[
...
...
@@ -14,6 +14,7 @@
def
rstify
(
orig
):
"""
Take contents of a .t file and produce reStructuredText
"""
newlines
=
[]
code_block_mode
=
False
...
...
@@ -21,7 +22,7 @@
for
line
in
orig
.
splitlines
():
# Em
t
py lines doesn't change output
# Emp
t
y lines doesn't change output
if
not
line
:
newlines
.
append
(
line
)
code_block_mode
=
False
...
...
@@ -59,7 +60,12 @@
return
"
\n
"
.
join
(
newlines
)
def
main
(
path
):
with
open
(
path
)
as
f
:
def
main
():
ap
=
argparse
.
ArgumentParser
()
ap
.
add_argument
(
'
testfile
'
,
help
=
'
.t file to transform
'
)
opts
=
ap
.
parse_args
()
with
open
(
opts
.
testfile
)
as
f
:
content
=
f
.
read
()
rst
=
rstify
(
content
)
...
...
@@ -64,8 +70,8 @@
content
=
f
.
read
()
rst
=
rstify
(
content
)
target
=
os
.
path
.
splitext
(
path
)[
0
]
+
'
.rst
'
target
=
os
.
path
.
splitext
(
opts
.
testfile
)[
0
]
+
'
.rst
'
with
open
(
target
,
'
w
'
)
as
f
:
f
.
write
(
rst
)
if
__name__
==
'
__main__
'
:
...
...
@@ -67,9 +73,6 @@
with
open
(
target
,
'
w
'
)
as
f
:
f
.
write
(
rst
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
!=
2
:
print
(
'
Please supply a path to tests dir as parameter
'
)
sys
.
exit
()
main
(
sys
.
argv
[
1
])
main
()
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