Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
5cd81507
Commit
5cd81507
authored
Mar 01, 2022
by
zhifan huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test runner
parent
68ded13f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
2 deletions
+44
-2
setup.py
setup.py
+1
-1
tests/runner.py
tests/runner.py
+42
-0
tests/test_registry.py
tests/test_registry.py
+1
-1
No files found.
setup.py
View file @
5cd81507
...
@@ -81,7 +81,7 @@ setup(
...
@@ -81,7 +81,7 @@ setup(
're6st-conf=re6st.cli.conf:main'
,
're6st-conf=re6st.cli.conf:main'
,
're6stnet=re6st.cli.node:main'
,
're6stnet=re6st.cli.node:main'
,
're6st-registry=re6st.cli.registry:main'
,
're6st-registry=re6st.cli.registry:main'
,
're6st-testrunner=tests.
test_registry
:main'
're6st-testrunner=tests.
runner
:main'
],
],
},
},
package_data
=
{
package_data
=
{
...
...
tests/runner.py
0 → 100644
View file @
5cd81507
import
sys
import
os
import
unittest
import
time
import
json
from
.test_registry
import
TestRegistrtServer
class
TestResult
(
unittest
.
TextTestResult
):
def
startTestRun
(
self
):
self
.
start
=
time
.
time
()
def
stopTestRun
(
self
):
self
.
end
=
time
.
time
()
self
.
report
=
dict
(
test_count
=
self
.
testsRun
,
error_count
=
len
(
self
.
errors
),
failure_count
=
len
(
self
.
failures
),
skip_count
=
len
(
self
.
skipped
),
duration
=
"%.2fs"
%
(
self
.
end
-
self
.
start
)
)
class
runner
(
unittest
.
TextTestRunner
):
def
_makeResult
(
self
):
return
TestResult
(
self
.
stream
,
self
.
descriptions
,
self
.
verbosity
)
def
main
():
test_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
os
.
chdir
(
test_dir
)
suite
=
unittest
.
TestSuite
()
for
method
in
dir
(
TestRegistrtServer
):
if
method
.
startswith
(
"test"
):
suite
.
addTest
(
TestRegistrtServer
(
method
))
result
=
runner
().
run
(
suite
)
print
json
.
dumps
(
result
.
report
)
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
tests/test_registry.py
View file @
5cd81507
...
@@ -506,7 +506,7 @@ def main():
...
@@ -506,7 +506,7 @@ def main():
for
method
in
dir
(
TestRegistrtServer
):
for
method
in
dir
(
TestRegistrtServer
):
if
method
.
startswith
(
"test"
):
if
method
.
startswith
(
"test"
):
suite
.
addTest
(
TestRegistrtServer
(
method
))
suite
.
addTest
(
TestRegistrtServer
(
method
))
unittest
.
TextTestRunner
().
run
(
suite
)
result
=
unittest
.
TextTestRunner
().
run
(
suite
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment