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
8da76aeb
Commit
8da76aeb
authored
Jan 29, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testrunner.py: store test's exception in the database and print it when printing stats
parent
ebed9269
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
+32
-5
greentest/testrunner.py
greentest/testrunner.py
+32
-5
No files found.
greentest/testrunner.py
View file @
8da76aeb
...
...
@@ -114,15 +114,22 @@ class DatabaseTestResult(_TextTestResult):
def
addSuccess
(
self
,
test
):
_TextTestResult
.
addSuccess
(
self
,
test
)
self
.
_store_result
(
test
,
'PASS'
)
self
.
_store_result
(
test
,
'PASS
ED
'
)
def
addError
(
self
,
test
,
err
):
_TextTestResult
.
addError
(
self
,
test
,
err
)
self
.
_store_result
(
test
,
'FAIL'
)
self
.
_store_result
(
test
,
format_exc_info
(
err
)
)
def
addFailure
(
self
,
test
,
err
):
_TextTestResult
.
addFailure
(
self
,
test
,
err
)
self
.
_store_result
(
test
,
'FAIL'
)
self
.
_store_result
(
test
,
format_exc_info
(
err
))
def
format_exc_info
(
exc_info
):
try
:
return
'%s: %s'
%
(
exc_info
[
0
].
__name__
,
exc_info
[
1
])
except
:
return
str
(
exc_info
[
1
])
or
str
(
exc_info
[
0
])
or
'FAILED'
class
DatabaseTestRunner
(
TextTestRunner
):
...
...
@@ -323,6 +330,19 @@ def get_testcases(cursor, runid, result=None):
return
[
'.'
.
join
(
x
)
for
x
in
cursor
.
execute
(
sql
,
args
).
fetchall
()]
def
get_failed_testcases
(
cursor
,
runid
):
sql
=
'select test, testcase, result from testcase where runid=?'
args
=
(
runid
,
)
sql
+=
' and result!="PASSED" and result!="TIMEOUT"'
names
=
[]
errors
=
{}
for
test
,
testcase
,
result
in
cursor
.
execute
(
sql
,
args
).
fetchall
():
name
=
'%s.%s'
%
(
test
,
testcase
)
names
.
append
(
name
)
errors
[
name
]
=
result
return
names
,
errors
_warning_re
=
re
.
compile
(
'
\
w*w
a
rning'
,
re
.
I
)
_error_re
=
re
.
compile
(
r'(?P<prefix>\
s*)T
raceback \
(mos
t recent call last\
):
' +
r'
(
\
n
(
?
P
=
prefix
)
\
s
+
.
*
)
+
\
n
(
?
P
=
prefix
)(
?
P
<
error
>
[
\
w
\
.]
+
)
')
...
...
@@ -395,7 +415,7 @@ def print_stats(options):
options.runid = cursor.execute('
select
runid
from
test
order
by
started_at
desc
limit
1
').fetchall()[0][0]
print '
Using
the
latest
runid
:
%
s
' % options.runid
total = len(get_testcases(cursor, options.runid))
failed
= get_testcases(cursor, options.runid, '
FAIL
'
)
failed
, errors = get_failed_testcases(cursor, options.runid
)
timedout = get_testcases(cursor, options.runid, '
TIMEOUT
')
for test, output, retcode in cursor.execute('
select
test
,
output
,
retcode
from
test
where
runid
=
?
', (options.runid, )):
info = get_info(output or '')
...
...
@@ -416,8 +436,15 @@ def print_stats(options):
failed.append(test)
total += 1
if failed:
failed.sort()
print '
FAILURES
:
'
print '
-
' + '
\
n
-
'.join(failed)
for testcase in failed:
error = errors.get(testcase)
if error:
error = repr(error)[1:-1][:100]
print '
-
%
s
:
%
s
' % (testcase, error)
else:
print '
-
%
s
' % (testcase, )
if timedout:
print '
TIMEOUTS
:
'
print '
-
' + '
\
n
-
'.join(timedout)
...
...
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