Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Gwenaël Samain
cython
Commits
30482ee8
Commit
30482ee8
authored
Jan 20, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
another xml test runner fix to make stdout/stderr output more accessible
parent
45685d47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Cython/Tests/xmlrunner.py
Cython/Tests/xmlrunner.py
+11
-11
No files found.
Cython/Tests/xmlrunner.py
View file @
30482ee8
...
@@ -53,14 +53,14 @@ class _TestInfo(object):
...
@@ -53,14 +53,14 @@ class _TestInfo(object):
# Possible test outcomes
# Possible test outcomes
(
SUCCESS
,
FAILURE
,
ERROR
)
=
range
(
3
)
(
SUCCESS
,
FAILURE
,
ERROR
)
=
range
(
3
)
def
__init__
(
self
,
test_result
,
test_method
,
outcome
=
SUCCESS
,
err
=
None
,
stdout
=
None
,
stderr
=
None
):
def
__init__
(
self
,
test_result
,
test_method
,
outcome
=
SUCCESS
,
err
=
None
):
"Create a new instance of _TestInfo."
"Create a new instance of _TestInfo."
self
.
test_result
=
test_result
self
.
test_result
=
test_result
self
.
test_method
=
test_method
self
.
test_method
=
test_method
self
.
outcome
=
outcome
self
.
outcome
=
outcome
self
.
err
=
err
self
.
err
=
err
self
.
stdout
=
stdout
self
.
stdout
=
test_result
.
stdout
and
test_result
.
stdout
.
getvalue
().
strip
()
or
''
self
.
stderr
=
stderr
self
.
stderr
=
test_result
.
stdout
and
test_result
.
stderr
.
getvalue
().
strip
()
or
''
def
get_elapsed_time
(
self
):
def
get_elapsed_time
(
self
):
"""Return the time that shows how long the test method took to
"""Return the time that shows how long the test method took to
...
@@ -154,19 +154,17 @@ class _XMLTestResult(_TextTestResult):
...
@@ -154,19 +154,17 @@ class _XMLTestResult(_TextTestResult):
def
addSuccess
(
self
,
test
):
def
addSuccess
(
self
,
test
):
"Called when a test executes successfully."
"Called when a test executes successfully."
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
,
stdout
=
self
.
stdout
,
stderr
=
self
.
stderr
),
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
),
self
.
successes
,
'OK'
,
'.'
)
self
.
successes
,
'OK'
,
'.'
)
def
addFailure
(
self
,
test
,
err
):
def
addFailure
(
self
,
test
,
err
):
"Called when a test method fails."
"Called when a test method fails."
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
,
_TestInfo
.
FAILURE
,
err
,
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
,
_TestInfo
.
FAILURE
,
err
),
stdout
=
self
.
stdout
,
stderr
=
self
.
stderr
),
self
.
failures
,
'FAIL'
,
'F'
)
self
.
failures
,
'FAIL'
,
'F'
)
def
addError
(
self
,
test
,
err
):
def
addError
(
self
,
test
,
err
):
"Called when a test method raises an error."
"Called when a test method raises an error."
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
,
_TestInfo
.
ERROR
,
err
,
self
.
_prepare_callback
(
_TestInfo
(
self
,
test
,
_TestInfo
.
ERROR
,
err
),
stdout
=
self
.
stdout
,
stderr
=
self
.
stderr
),
self
.
errors
,
'ERROR'
,
'E'
)
self
.
errors
,
'ERROR'
,
'E'
)
def
printErrorList
(
self
,
flavour
,
errors
):
def
printErrorList
(
self
,
flavour
,
errors
):
...
@@ -281,10 +279,12 @@ class _XMLTestResult(_TextTestResult):
...
@@ -281,10 +279,12 @@ class _XMLTestResult(_TextTestResult):
stdout
,
stderr
=
[],
[]
stdout
,
stderr
=
[],
[]
for
test
in
tests
:
for
test
in
tests
:
_XMLTestResult
.
_report_testcase
(
suite
,
test
,
testsuite
,
doc
)
_XMLTestResult
.
_report_testcase
(
suite
,
test
,
testsuite
,
doc
)
stdout
.
append
(
test
.
stdout
and
test
.
stdout
.
getvalue
()
or
''
)
if
test
.
stdout
:
stderr
.
append
(
test
.
stderr
and
test
.
stderr
.
getvalue
()
or
''
)
stdout
.
extend
([
'*****************'
,
test
.
get_description
(),
test
.
stdout
])
if
test
.
stderr
:
stderr
.
extend
([
'*****************'
,
test
.
get_description
(),
test
.
stderr
])
_XMLTestResult
.
_report_output
(
test_runner
,
testsuite
,
doc
,
_XMLTestResult
.
_report_output
(
test_runner
,
testsuite
,
doc
,
'
\
n
'
.
join
(
stdout
)
.
strip
(),
'
\
n
'
.
join
(
stderr
).
strip
(
))
'
\
n
'
.
join
(
stdout
)
,
'
\
n
'
.
join
(
stderr
))
xml_content
=
doc
.
toprettyxml
(
indent
=
'
\
t
'
)
xml_content
=
doc
.
toprettyxml
(
indent
=
'
\
t
'
)
if
type
(
test_runner
.
output
)
is
str
:
if
type
(
test_runner
.
output
)
is
str
:
...
...
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