summaryrefslogtreecommitdiff
path: root/chromium/tools/clang/pylib
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/tools/clang/pylib')
-rwxr-xr-xchromium/tools/clang/pylib/clang/compile_db.py2
-rwxr-xr-xchromium/tools/clang/pylib/clang/compile_db_test.py6
-rwxr-xr-xchromium/tools/clang/pylib/clang/plugin_testing.py6
3 files changed, 10 insertions, 4 deletions
diff --git a/chromium/tools/clang/pylib/clang/compile_db.py b/chromium/tools/clang/pylib/clang/compile_db.py
index 46220af8b90..50decf71907 100755
--- a/chromium/tools/clang/pylib/clang/compile_db.py
+++ b/chromium/tools/clang/pylib/clang/compile_db.py
@@ -67,7 +67,7 @@ def _ProcessEntry(entry):
match = _RSP_RE.search(entry['command'])
if match:
rsp_path = os.path.join(entry['directory'], match.group(2))
- rsp_contents = file(rsp_path).read()
+ rsp_contents = open(rsp_path).read()
entry['command'] = ''.join([
entry['command'][:match.start(1)],
rsp_contents,
diff --git a/chromium/tools/clang/pylib/clang/compile_db_test.py b/chromium/tools/clang/pylib/clang/compile_db_test.py
index 493f2f815db..9ec818bbb5e 100755
--- a/chromium/tools/clang/pylib/clang/compile_db_test.py
+++ b/chromium/tools/clang/pylib/clang/compile_db_test.py
@@ -62,7 +62,11 @@ class CompileDbTest(unittest.TestCase):
_TEST_COMPILE_DB)
# Assert no changes were made.
- self.assertItemsEqual(processed_compile_db, _TEST_COMPILE_DB)
+ try:
+ # assertItemsEqual is renamed assertCountEqual in Python3.
+ self.assertCountEqual(processed_compile_db, _TEST_COMPILE_DB)
+ except AttributeError:
+ self.assertItemsEqual(processed_compile_db, _TEST_COMPILE_DB)
def testProcessForWindows(self):
sys.platform = 'win32'
diff --git a/chromium/tools/clang/pylib/clang/plugin_testing.py b/chromium/tools/clang/pylib/clang/plugin_testing.py
index 7082ac87978..6b2e6067118 100755
--- a/chromium/tools/clang/pylib/clang/plugin_testing.py
+++ b/chromium/tools/clang/pylib/clang/plugin_testing.py
@@ -63,7 +63,7 @@ class ClangPluginTest(object):
cmd = clang_cmd[:]
try:
# Some tests need to run with extra flags.
- cmd.extend(file('%s.flags' % test_name).read().split())
+ cmd.extend(open('%s.flags' % test_name).read().split())
except IOError:
pass
cmd.append(test)
@@ -85,7 +85,9 @@ class ClangPluginTest(object):
def RunOneTest(self, test_name, cmd):
try:
- actual = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ actual = subprocess.check_output(cmd,
+ stderr=subprocess.STDOUT,
+ universal_newlines=True)
except subprocess.CalledProcessError as e:
# Some plugin tests intentionally trigger compile errors, so just ignore
# an exit code that indicates failure.