CodeHealth: Python3 migration for tools_webrtc/mb/
This CL includes: * set Pylint to 2.7 in tools_webrtc/mb/PRESUBMIT.py * fix some style warnings caused by scripts in tools_webrtc/mb/ * pass skip_shebang_check=True within tools_webrtc/mb/PRESUBMIT.py Bug: chromium:1262287, chromium:1262352 Change-Id: Iae4f111942d724db6a7f4585c97a7c26c1e6ccc0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239660 Commit-Queue: Nidhi Jaju <nidhijaju@chromium.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35477}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
73d0774b6b
commit
2394977f74
@ -11,7 +11,10 @@
|
||||
|
||||
import ast
|
||||
import json
|
||||
import StringIO
|
||||
try:
|
||||
from StringIO import StringIO # for Python2
|
||||
except ImportError:
|
||||
from io import StringIO # for Python3
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@ -96,7 +99,7 @@ class FakeMBW(mb.MetaBuildWrapper):
|
||||
self.dirs.add(tmp_dir)
|
||||
return tmp_dir
|
||||
|
||||
def TempFile(self, mode='w'):
|
||||
def TempFile(self):
|
||||
return FakeFile(self.files)
|
||||
|
||||
def RemoveFile(self, path):
|
||||
@ -116,8 +119,7 @@ class FakeMBW(mb.MetaBuildWrapper):
|
||||
path = self.PathJoin(self.cwd, path)
|
||||
if self.sep == '\\':
|
||||
return re.sub(r'\\+', r'\\', path)
|
||||
else:
|
||||
return re.sub('/+', '/', path)
|
||||
return re.sub('/+', '/', path)
|
||||
|
||||
|
||||
class FakeFile(object):
|
||||
@ -859,7 +861,7 @@ class UnitTest(unittest.TestCase):
|
||||
def test_help(self):
|
||||
orig_stdout = sys.stdout
|
||||
try:
|
||||
sys.stdout = StringIO.StringIO()
|
||||
sys.stdout = StringIO()
|
||||
self.assertRaises(SystemExit, self.check, ['-h'])
|
||||
self.assertRaises(SystemExit, self.check, ['help'])
|
||||
self.assertRaises(SystemExit, self.check, ['help', 'gen'])
|
||||
|
Reference in New Issue
Block a user