changeset 50452:e07dc1e7a454

tests: in filterpyflakes, tolerate non-ascii file contents
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Fri, 10 Mar 2023 11:20:18 +0000
parents 584ff1f97201
children 7f0f3b274d1e
files tests/filterpyflakes.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/filterpyflakes.py	Mon Jan 30 13:37:48 2023 +0000
+++ b/tests/filterpyflakes.py	Fri Mar 10 11:20:18 2023 +0000
@@ -24,10 +24,9 @@
             break  # pattern matches
     if keep:
         fn = line.split(':', 1)[0]
-        f = open(fn)
-        data = f.read()
-        f.close()
-        if 'no-' 'check-code' in data:
+        with open(fn, 'rb') as f:
+            data = f.read()
+        if b'no-' b'check-code' in data:
             continue
         lines.append(line)