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
33d42e25
Commit
33d42e25
authored
10 years ago
by
cody burkard
Browse files
Options
Downloads
Patches
Plain Diff
if a test fails or exits with an error, run cleanup as a precaution
parent
098bede0
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
+13
-1
13 additions, 1 deletion
examples/test/runner.py
with
13 additions
and
1 deletion
examples/test/runner.py
+
13
−
1
View file @
33d42e25
...
...
@@ -12,6 +12,18 @@
from
mininet.util
import
ensureRoot
from
mininet.clean
import
cleanup
class
MininetTestResult
(
unittest
.
TextTestResult
):
def
addFailure
(
self
,
test
,
err
):
super
(
MininetTestResult
,
self
).
addFailure
(
test
,
err
)
cleanup
()
def
addError
(
self
,
test
,
err
):
super
(
MininetTestResult
,
self
).
addError
(
test
,
err
)
cleanup
()
class
MininetTestRunner
(
unittest
.
TextTestRunner
):
def
_makeResult
(
self
):
return
MininetTestResult
(
self
.
stream
,
self
.
descriptions
,
self
.
verbosity
)
def
runTests
(
testDir
,
verbosity
=
1
):
"
discover and run all tests in testDir
"
# ensure root and cleanup before starting tests
...
...
@@ -20,7 +32,7 @@ def runTests( testDir, verbosity=1 ):
# discover all tests in testDir
testSuite
=
unittest
.
defaultTestLoader
.
discover
(
testDir
)
# run tests
unittest
.
Tex
tTestRunner
(
verbosity
=
verbosity
).
run
(
testSuite
)
Minine
tTestRunner
(
verbosity
=
verbosity
).
run
(
testSuite
)
if
__name__
==
'
__main__
'
:
# get the directory containing example tests
...
...
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