Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Olaf Bergmann
mininet
Commits
10fdd01d
Commit
10fdd01d
authored
11 years ago
by
Brian O'Connor
Browse files
Options
Downloads
Patches
Plain Diff
fixed runner.py and added -v and -quick options
parent
1e9e781c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/test/runner.py
+27
-8
27 additions, 8 deletions
examples/test/runner.py
with
27 additions
and
8 deletions
examples/test/runner.py
100644 → 100755
+
27
−
8
View file @
10fdd01d
import
glob
#!/usr/bin/env python
"""
Run all mininet.examples tests
-v : verbose output
-quick : skip tests that take more than ~30 seconds
"""
import
unittest
import
os
import
sys
from
mininet.util
import
ensureRoot
from
mininet.clean
import
cleanup
def
runTests
(
testDir
,
verbosity
=
1
):
"
discover and run all tests in testDir
"
# ensure root and cleanup before starting tests
ensureRoot
()
cleanup
()
# discover all tests in testDir
testSuite
=
unittest
.
defaultTestLoader
.
discover
(
testDir
)
# run tests
unittest
.
TextTestRunner
(
verbosity
=
verbosity
).
run
(
testSuite
)
test_file_strings
=
glob
.
glob
(
'
test_*.py
'
)
module_strings
=
[
str
[
0
:
len
(
str
)
-
3
]
for
str
in
test_file_strings
]
print
module_strings
suites
=
[
unittest
.
defaultTestLoader
.
loadTestsFromName
(
str
)
for
str
in
module_strings
]
testSuite
=
unittest
.
TestSuite
(
suites
)
text_runner
=
unittest
.
TextTestRunner
().
run
(
testSuite
)
\ No newline at end of file
if
__name__
==
'
__main__
'
:
# get the directory containing example tests
testDir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)
)
verbosity
=
2
if
'
-v
'
in
sys
.
argv
else
1
runTests
(
testDir
,
verbosity
)
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