diff options
author | Peter Levine <plevine457@gmail.com> | 2018-09-14 23:40:51 (GMT) |
---|---|---|
committer | Peter Levine <plevine457@gmail.com> | 2018-09-14 23:40:51 (GMT) |
commit | 149c0d24148da9a339d6c9d03e638a39c59731f6 (patch) | |
tree | d4d1991631be4474135690b7fa3ec15f014ffd8a /googletest/test/googletest-filter-unittest.py | |
parent | bc2d0935b74917be0821bfd834472ed9cc4a3b5b (diff) | |
download | googletest-149c0d24148da9a339d6c9d03e638a39c59731f6.zip googletest-149c0d24148da9a339d6c9d03e638a39c59731f6.tar.gz googletest-149c0d24148da9a339d6c9d03e638a39c59731f6.tar.bz2 |
Fix Python3 support
Diffstat (limited to 'googletest/test/googletest-filter-unittest.py')
-rwxr-xr-x | googletest/test/googletest-filter-unittest.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/googletest/test/googletest-filter-unittest.py b/googletest/test/googletest-filter-unittest.py index dc0b5bd..6b32f2d 100755 --- a/googletest/test/googletest-filter-unittest.py +++ b/googletest/test/googletest-filter-unittest.py @@ -42,7 +42,10 @@ we test that here also. import os import re -import sets +try: + from sets import Set as set # For Python 2.3 compatibility +except ImportError: + pass import sys import gtest_test_utils @@ -57,7 +60,7 @@ CAN_PASS_EMPTY_ENV = False if sys.executable: os.environ['EMPTY_VAR'] = '' 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) @@ -72,7 +75,7 @@ if sys.executable: os.environ['UNSET_VAR'] = 'X' del os.environ['UNSET_VAR'] 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) @@ -245,14 +248,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase): for slice_var in list_of_sets: full_partition.extend(slice_var) self.assertEqual(len(set_var), len(full_partition)) - self.assertEqual(sets.Set(set_var), sets.Set(full_partition)) + self.assertEqual(set(set_var), set(full_partition)) def AdjustForParameterizedTests(self, tests_to_run): """Adjust tests_to_run in case value parameterized tests are disabled.""" global param_tests_present if not param_tests_present: - return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS)) + return list(set(tests_to_run) - set(PARAM_TESTS)) else: return tests_to_run |