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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
e2512eae
Commit
e2512eae
authored
Feb 23, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmlrunner: use TextNode when data can't be represented as single CDATA
parent
db8c5d5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
Cython/Tests/xmlrunner.py
Cython/Tests/xmlrunner.py
+12
-5
No files found.
Cython/Tests/xmlrunner.py
View file @
e2512eae
...
@@ -43,6 +43,14 @@ import sys
...
@@ -43,6 +43,14 @@ import sys
import
time
import
time
from
unittest
import
TestResult
,
_TextTestResult
,
TextTestRunner
from
unittest
import
TestResult
,
_TextTestResult
,
TextTestRunner
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
import
xml.dom.minidom
class
XMLDocument
(
xml
.
dom
.
minidom
.
Document
):
def
createCDATAOrText
(
self
,
data
):
if
']]>'
in
data
:
return
self
.
createTextNode
(
data
)
return
self
.
createCDATASection
(
data
)
class
_TestInfo
(
object
):
class
_TestInfo
(
object
):
...
@@ -245,7 +253,7 @@ class _XMLTestResult(_TextTestResult):
...
@@ -245,7 +253,7 @@ class _XMLTestResult(_TextTestResult):
failure
.
setAttribute
(
'message'
,
str
(
test_result
.
err
[
1
]))
failure
.
setAttribute
(
'message'
,
str
(
test_result
.
err
[
1
]))
error_info
=
test_result
.
get_error_info
()
error_info
=
test_result
.
get_error_info
()
failureText
=
xml_document
.
createCDATA
Section
(
error_info
)
failureText
=
xml_document
.
createCDATA
OrText
(
error_info
)
failure
.
appendChild
(
failureText
)
failure
.
appendChild
(
failureText
)
_report_testcase
=
staticmethod
(
_report_testcase
)
_report_testcase
=
staticmethod
(
_report_testcase
)
...
@@ -255,20 +263,19 @@ class _XMLTestResult(_TextTestResult):
...
@@ -255,20 +263,19 @@ class _XMLTestResult(_TextTestResult):
systemout
=
xml_document
.
createElement
(
'system-out'
)
systemout
=
xml_document
.
createElement
(
'system-out'
)
xml_testsuite
.
appendChild
(
systemout
)
xml_testsuite
.
appendChild
(
systemout
)
systemout_text
=
xml_document
.
createCDATA
Section
(
stdout
)
systemout_text
=
xml_document
.
createCDATA
OrText
(
stdout
)
systemout
.
appendChild
(
systemout_text
)
systemout
.
appendChild
(
systemout_text
)
systemerr
=
xml_document
.
createElement
(
'system-err'
)
systemerr
=
xml_document
.
createElement
(
'system-err'
)
xml_testsuite
.
appendChild
(
systemerr
)
xml_testsuite
.
appendChild
(
systemerr
)
systemerr_text
=
xml_document
.
createCDATA
Section
(
stderr
)
systemerr_text
=
xml_document
.
createCDATA
OrText
(
stderr
)
systemerr
.
appendChild
(
systemerr_text
)
systemerr
.
appendChild
(
systemerr_text
)
_report_output
=
staticmethod
(
_report_output
)
_report_output
=
staticmethod
(
_report_output
)
def
generate_reports
(
self
,
test_runner
):
def
generate_reports
(
self
,
test_runner
):
"Generates the XML reports to a given XMLTestRunner object."
"Generates the XML reports to a given XMLTestRunner object."
from
xml.dom.minidom
import
Document
all_results
=
self
.
_get_info_by_testcase
()
all_results
=
self
.
_get_info_by_testcase
()
if
type
(
test_runner
.
output
)
==
str
and
not
\
if
type
(
test_runner
.
output
)
==
str
and
not
\
...
@@ -276,7 +283,7 @@ class _XMLTestResult(_TextTestResult):
...
@@ -276,7 +283,7 @@ class _XMLTestResult(_TextTestResult):
os
.
makedirs
(
test_runner
.
output
)
os
.
makedirs
(
test_runner
.
output
)
for
suite
,
tests
in
all_results
.
items
():
for
suite
,
tests
in
all_results
.
items
():
doc
=
Document
()
doc
=
XML
Document
()
# Build the XML file
# Build the XML file
testsuite
=
_XMLTestResult
.
_report_testsuite
(
suite
,
tests
,
doc
)
testsuite
=
_XMLTestResult
.
_report_testsuite
(
suite
,
tests
,
doc
)
...
...
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