fix encoding for _GetYapfIgnorePatterns so it supports utf-8
Bug: 1204441
Change-Id: I36b963d69b5dec9e609258055b800b14d398b2b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2864013
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Anthony Polito <apolito@google.com>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 623bdcc..e93fecc 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -3947,8 +3947,8 @@
super(CMDFormatTestCase, self).tearDown()
def _make_temp_file(self, fname, contents):
- with open(os.path.join(self._top_dir, fname), 'w') as tf:
- tf.write('\n'.join(contents))
+ gclient_utils.FileWrite(os.path.join(self._top_dir, fname),
+ ('\n'.join(contents)))
def _make_yapfignore(self, contents):
self._make_temp_file('.yapfignore', contents)
@@ -4063,6 +4063,18 @@
]
self._check_yapf_filtering(files, expected)
+ def testYapfHandleUtf8(self):
+ self._make_yapfignore(['test.py', 'test_🌐.py'])
+ files = [
+ 'test.py',
+ 'test_🌐.py',
+ 'test2.py',
+ ]
+ expected = [
+ 'test2.py',
+ ]
+ self._check_yapf_filtering(files, expected)
+
def testYapfignoreBlankLines(self):
self._make_yapfignore(['test.py', '', '', 'test2.py'])
files = [