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
32dbcac0
Commit
32dbcac0
authored
Oct 22, 2018
by
Gennadiy Civil
Browse files
Merge pull request #1839 from Peter-Levine:python3-tests
PiperOrigin-RevId: 217925156
parents
572050dd
c955e334
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
13 deletions
+17
-13
googletest/test/googletest-env-var-test.py
googletest/test/googletest-env-var-test.py
+2
-2
googletest/test/googletest-filter-unittest.py
googletest/test/googletest-filter-unittest.py
+8
-5
googletest/test/googletest-output-test.py
googletest/test/googletest-output-test.py
+1
-1
googletest/test/googletest-throw-on-failure-test.py
googletest/test/googletest-throw-on-failure-test.py
+1
-1
googletest/test/googletest-uninitialized-test.py
googletest/test/googletest-uninitialized-test.py
+2
-2
googletest/test/gtest_xml_output_unittest.py
googletest/test/gtest_xml_output_unittest.py
+2
-1
googletest/test/gtest_xml_test_utils.py
googletest/test/gtest_xml_test_utils.py
+1
-1
No files found.
googletest/test/googletest-env-var-test.py
View file @
32dbcac0
...
@@ -45,8 +45,8 @@ environ = os.environ.copy()
...
@@ -45,8 +45,8 @@ environ = os.environ.copy()
def
AssertEq
(
expected
,
actual
):
def
AssertEq
(
expected
,
actual
):
if
expected
!=
actual
:
if
expected
!=
actual
:
print
'Expected: %s'
%
(
expected
,)
print
(
'Expected: %s'
%
(
expected
,)
)
print
' Actual: %s'
%
(
actual
,)
print
(
' Actual: %s'
%
(
actual
,)
)
raise
AssertionError
raise
AssertionError
...
...
googletest/test/googletest-filter-unittest.py
View file @
32dbcac0
...
@@ -42,7 +42,10 @@ we test that here also.
...
@@ -42,7 +42,10 @@ we test that here also.
import
os
import
os
import
re
import
re
import
sets
try
:
from
sets
import
Set
as
set
# For Python 2.3 compatibility
except
ImportError
:
pass
import
sys
import
sys
import
gtest_test_utils
import
gtest_test_utils
...
@@ -57,7 +60,7 @@ CAN_PASS_EMPTY_ENV = False
...
@@ -57,7 +60,7 @@ CAN_PASS_EMPTY_ENV = False
if
sys
.
executable
:
if
sys
.
executable
:
os
.
environ
[
'EMPTY_VAR'
]
=
''
os
.
environ
[
'EMPTY_VAR'
]
=
''
child
=
gtest_test_utils
.
Subprocess
(
child
=
gtest_test_utils
.
Subprocess
(
[
sys
.
executable
,
'-c'
,
'import os; print
\'
EMPTY_VAR
\'
in os.environ'
])
[
sys
.
executable
,
'-c'
,
'import os; print
(
\'
EMPTY_VAR
\'
in os.environ
)
'
])
CAN_PASS_EMPTY_ENV
=
eval
(
child
.
output
)
CAN_PASS_EMPTY_ENV
=
eval
(
child
.
output
)
...
@@ -72,7 +75,7 @@ if sys.executable:
...
@@ -72,7 +75,7 @@ if sys.executable:
os
.
environ
[
'UNSET_VAR'
]
=
'X'
os
.
environ
[
'UNSET_VAR'
]
=
'X'
del
os
.
environ
[
'UNSET_VAR'
]
del
os
.
environ
[
'UNSET_VAR'
]
child
=
gtest_test_utils
.
Subprocess
(
child
=
gtest_test_utils
.
Subprocess
(
[
sys
.
executable
,
'-c'
,
'import os; print
\'
UNSET_VAR
\'
not in os.environ'
[
sys
.
executable
,
'-c'
,
'import os; print
(
\'
UNSET_VAR
\'
not in os.environ
)
'
])
])
CAN_UNSET_ENV
=
eval
(
child
.
output
)
CAN_UNSET_ENV
=
eval
(
child
.
output
)
...
@@ -245,14 +248,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
...
@@ -245,14 +248,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
for
slice_var
in
list_of_sets
:
for
slice_var
in
list_of_sets
:
full_partition
.
extend
(
slice_var
)
full_partition
.
extend
(
slice_var
)
self
.
assertEqual
(
len
(
set_var
),
len
(
full_partition
))
self
.
assertEqual
(
len
(
set_var
),
len
(
full_partition
))
self
.
assertEqual
(
set
s
.
Set
(
set_var
),
set
s
.
Set
(
full_partition
))
self
.
assertEqual
(
set
(
set_var
),
set
(
full_partition
))
def
AdjustForParameterizedTests
(
self
,
tests_to_run
):
def
AdjustForParameterizedTests
(
self
,
tests_to_run
):
"""Adjust tests_to_run in case value parameterized tests are disabled."""
"""Adjust tests_to_run in case value parameterized tests are disabled."""
global
param_tests_present
global
param_tests_present
if
not
param_tests_present
:
if
not
param_tests_present
:
return
list
(
set
s
.
Set
(
tests_to_run
)
-
set
s
.
Set
(
PARAM_TESTS
))
return
list
(
set
(
tests_to_run
)
-
set
(
PARAM_TESTS
))
else
:
else
:
return
tests_to_run
return
tests_to_run
...
...
googletest/test/googletest-output-test.py
View file @
32dbcac0
...
@@ -287,7 +287,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
...
@@ -287,7 +287,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
# sequences when we read the golden file irrespective of an operating
# sequences when we read the golden file irrespective of an operating
# system used. Therefore, we need to strip those \r's from newlines
# system used. Therefore, we need to strip those \r's from newlines
# unconditionally.
# unconditionally.
golden
=
ToUnixLineEnding
(
golden_file
.
read
())
golden
=
ToUnixLineEnding
(
golden_file
.
read
()
.
decode
()
)
golden_file
.
close
()
golden_file
.
close
()
# We want the test to pass regardless of certain features being
# We want the test to pass regardless of certain features being
...
...
googletest/test/googletest-throw-on-failure-test.py
View file @
32dbcac0
...
@@ -68,7 +68,7 @@ def SetEnvVar(env_var, value):
...
@@ -68,7 +68,7 @@ def SetEnvVar(env_var, value):
def
Run
(
command
):
def
Run
(
command
):
"""Runs a command; returns True/False if its exit code is/isn't 0."""
"""Runs a command; returns True/False if its exit code is/isn't 0."""
print
'Running "%s". . .'
%
' '
.
join
(
command
)
print
(
'Running "%s". . .'
%
' '
.
join
(
command
)
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
return
p
.
exited
and
p
.
exit_code
==
0
return
p
.
exited
and
p
.
exit_code
==
0
...
...
googletest/test/googletest-uninitialized-test.py
View file @
32dbcac0
...
@@ -43,8 +43,8 @@ def Assert(condition):
...
@@ -43,8 +43,8 @@ def Assert(condition):
def
AssertEq
(
expected
,
actual
):
def
AssertEq
(
expected
,
actual
):
if
expected
!=
actual
:
if
expected
!=
actual
:
print
'Expected: %s'
%
(
expected
,)
print
(
'Expected: %s'
%
(
expected
,)
)
print
' Actual: %s'
%
(
actual
,)
print
(
' Actual: %s'
%
(
actual
,)
)
raise
AssertionError
raise
AssertionError
...
...
googletest/test/gtest_xml_output_unittest.py
View file @
32dbcac0
...
@@ -266,7 +266,8 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -266,7 +266,8 @@ 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
,
e
:
except
OSError
:
e
=
sys
.
exc_info
()[
1
]
if
e
.
errno
!=
errno
.
ENOENT
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
raise
...
...
googletest/test/gtest_xml_test_utils.py
View file @
32dbcac0
...
@@ -94,7 +94,7 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
...
@@ -94,7 +94,7 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
self
.
assertEquals
(
self
.
assertEquals
(
len
(
expected_children
),
len
(
actual_children
),
len
(
expected_children
),
len
(
actual_children
),
'number of child elements differ in element '
+
actual_node
.
tagName
)
'number of child elements differ in element '
+
actual_node
.
tagName
)
for
child_id
,
child
in
expected_children
.
iter
items
():
for
child_id
,
child
in
expected_children
.
items
():
self
.
assert_
(
child_id
in
actual_children
,
self
.
assert_
(
child_id
in
actual_children
,
'<%s> is not in <%s> (in element %s)'
%
'<%s> is not in <%s> (in element %s)'
%
(
child_id
,
actual_children
,
actual_node
.
tagName
))
(
child_id
,
actual_children
,
actual_node
.
tagName
))
...
...
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