Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Kirill Smelkov
gevent
Commits
c57798fc
Commit
c57798fc
authored
Mar 26, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testrunner.py: split spawn_subprocesses in 2 functions
parent
aed40b50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
38 deletions
+50
-38
greentest/testrunner.py
greentest/testrunner.py
+50
-38
No files found.
greentest/testrunner.py
View file @
c57798fc
...
@@ -45,6 +45,7 @@ import sys
...
@@ -45,6 +45,7 @@ import sys
import
os
import
os
import
glob
import
glob
import
re
import
re
import
traceback
from
unittest
import
_TextTestResult
,
defaultTestLoader
,
TextTestRunner
from
unittest
import
_TextTestResult
,
defaultTestLoader
,
TextTestRunner
import
platform
import
platform
...
@@ -273,13 +274,8 @@ def run_subprocess(arg, options):
...
@@ -273,13 +274,8 @@ def run_subprocess(arg, options):
return
retcode
[
0
],
output
return
retcode
[
0
],
output
def
spawn_subprocesses
(
options
,
args
):
def
spawn_subprocess
(
arg
,
options
):
if
not
args
:
success
=
False
args
=
glob
.
glob
(
'test_*.py'
)
args
.
remove
(
'test_support.py'
)
fail
=
False
uname
=
platform
.
uname
()[
0
]
for
arg
in
args
:
if
options
.
db
:
if
options
.
db
:
module_name
=
arg
module_name
=
arg
if
module_name
.
endswith
(
'.py'
):
if
module_name
.
endswith
(
'.py'
):
...
@@ -292,7 +288,7 @@ def spawn_subprocesses(options, args):
...
@@ -292,7 +288,7 @@ def spawn_subprocesses(options, args):
'changeset'
:
get_changeset
(),
'changeset'
:
get_changeset
(),
'libevent_version'
:
get_libevent_version
(),
'libevent_version'
:
get_libevent_version
(),
'libevent_method'
:
get_libevent_method
(),
'libevent_method'
:
get_libevent_method
(),
'uname'
:
uname
,
'uname'
:
options
.
uname
,
'retcode'
:
'TIMEOUT'
}
'retcode'
:
'TIMEOUT'
}
row_id
=
store_record
(
options
.
db
,
'test'
,
params
)
row_id
=
store_record
(
options
.
db
,
'test'
,
params
)
params
[
'id'
]
=
row_id
params
[
'id'
]
=
row_id
...
@@ -302,27 +298,43 @@ def spawn_subprocesses(options, args):
...
@@ -302,27 +298,43 @@ def spawn_subprocesses(options, args):
if
retcode
:
if
retcode
:
sys
.
stdout
.
write
(
output
)
sys
.
stdout
.
write
(
output
)
print
'%s failed with code %s'
%
(
arg
,
retcode
)
print
'%s failed with code %s'
%
(
arg
,
retcode
)
fail
=
True
elif
retcode
==
0
:
elif
retcode
==
0
:
if
options
.
verbosity
==
1
:
# // if verbosity is 2 then output is always printed by run_subprocess
if
options
.
verbosity
==
1
:
# // if verbosity is 2 then output is always printed by run_subprocess
sys
.
stdout
.
write
(
output
)
sys
.
stdout
.
write
(
output
)
print
'%s passed'
%
arg
print
'%s passed'
%
arg
success
=
True
else
:
else
:
print
'%s timed out'
%
arg
print
'%s timed out'
%
arg
fail
=
True
if
options
.
db
:
if
options
.
db
:
params
[
'output'
]
=
output
params
[
'output'
]
=
output
params
[
'retcode'
]
=
retcode
params
[
'retcode'
]
=
retcode
store_record
(
options
.
db
,
'test'
,
params
)
store_record
(
options
.
db
,
'test'
,
params
)
return
success
def
spawn_subprocesses
(
options
,
args
):
success
=
True
if
not
args
:
args
=
glob
.
glob
(
'test_*.py'
)
args
.
remove
(
'test_support.py'
)
options
.
uname
=
platform
.
uname
()[
0
]
for
arg
in
args
:
try
:
success
=
spawn_subprocess
(
arg
,
options
)
and
success
except
Exception
:
try
:
traceback
.
print_exc
()
except
Exception
:
pass
if
options
.
db
:
if
options
.
db
:
try
:
try
:
print
'-'
*
80
print
'-'
*
80
if
print_stats
(
options
):
if
print_stats
(
options
):
fail
=
Tru
e
success
=
Fals
e
except
sqlite3
.
OperationalError
,
ex
:
except
sqlite3
.
OperationalError
,
ex
:
print
ex
print
ex
print
'To view stats again for this run, use %s --stats --runid %s --db %s'
%
(
sys
.
argv
[
0
],
options
.
runid
,
options
.
db
)
print
'To view stats again for this run, use %s --stats --runid %s --db %s'
%
(
sys
.
argv
[
0
],
options
.
runid
,
options
.
db
)
if
fail
:
if
not
success
:
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
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