Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
6befe422
Commit
6befe422
authored
Jan 15, 2018
by
Gennadiy Civil
Browse files
Test files for corresponding changes
parent
f45c22c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
googletest/test/gtest_xml_output_unittest.py
googletest/test/gtest_xml_output_unittest.py
+9
-6
No files found.
googletest/test/gtest_xml_output_unittest.py
View file @
6befe422
...
@@ -200,7 +200,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -200,7 +200,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
Runs a test program that generates an empty XML output, and checks if
Runs a test program that generates an empty XML output, and checks if
the timestamp attribute in the testsuites tag is valid.
the timestamp attribute in the testsuites tag is valid.
"""
"""
actual
=
self
.
_GetXmlOutput
(
'gtest_no_test_unittest'
,
[],
0
)
actual
=
self
.
_GetXmlOutput
(
'gtest_no_test_unittest'
,
[],
{},
0
)
date_time_str
=
actual
.
documentElement
.
getAttributeNode
(
'timestamp'
).
value
date_time_str
=
actual
.
documentElement
.
getAttributeNode
(
'timestamp'
).
value
# datetime.strptime() is only available in Python 2.5+ so we have to
# datetime.strptime() is only available in Python 2.5+ so we have to
# parse the expected datetime manually.
# parse the expected datetime manually.
...
@@ -230,8 +230,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -230,8 +230,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
'gtest_no_test_unittest'
)
'gtest_no_test_unittest'
)
try
:
try
:
os
.
remove
(
output_file
)
os
.
remove
(
output_file
)
except
OSError
:
except
OSError
,
e
:
e
=
sys
.
exc_info
()[
1
]
if
e
.
errno
!=
errno
.
ENOENT
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
raise
...
@@ -307,7 +306,11 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -307,7 +306,11 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
command
=
([
gtest_prog_path
,
'%s=xml:%s'
%
(
GTEST_OUTPUT_FLAG
,
xml_path
)]
+
command
=
([
gtest_prog_path
,
'%s=xml:%s'
%
(
GTEST_OUTPUT_FLAG
,
xml_path
)]
+
extra_args
)
extra_args
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
environ_copy
=
os
.
environ
.
copy
()
if
extra_env
:
environ_copy
.
update
(
extra_env
)
p
=
gtest_test_utils
.
Subprocess
(
command
,
env
=
environ_copy
)
if
p
.
terminated_by_signal
:
if
p
.
terminated_by_signal
:
self
.
assert_
(
False
,
self
.
assert_
(
False
,
'%s was killed by signal %d'
%
(
gtest_prog_name
,
p
.
signal
))
'%s was killed by signal %d'
%
(
gtest_prog_name
,
p
.
signal
))
...
@@ -321,7 +324,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -321,7 +324,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
return
actual
return
actual
def
_TestXmlOutput
(
self
,
gtest_prog_name
,
expected_xml
,
def
_TestXmlOutput
(
self
,
gtest_prog_name
,
expected_xml
,
expected_exit_code
,
extra_args
=
None
):
expected_exit_code
,
extra_args
=
None
,
extra_env
=
None
):
"""
"""
Asserts that the XML document generated by running the program
Asserts that the XML document generated by running the program
gtest_prog_name matches expected_xml, a string containing another
gtest_prog_name matches expected_xml, a string containing another
...
@@ -330,7 +333,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -330,7 +333,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
"""
"""
actual
=
self
.
_GetXmlOutput
(
gtest_prog_name
,
extra_args
or
[],
actual
=
self
.
_GetXmlOutput
(
gtest_prog_name
,
extra_args
or
[],
expected_exit_code
)
extra_env
or
{},
expected_exit_code
)
expected
=
minidom
.
parseString
(
expected_xml
)
expected
=
minidom
.
parseString
(
expected_xml
)
self
.
NormalizeXml
(
actual
.
documentElement
)
self
.
NormalizeXml
(
actual
.
documentElement
)
self
.
AssertEquivalentNodes
(
expected
.
documentElement
,
self
.
AssertEquivalentNodes
(
expected
.
documentElement
,
...
...
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