##// END OF EJS Templates
tests: in filterpyflakes, tolerate non-ascii file contents
Arseniy Alekseyev -
r51329:e07dc1e7 default
parent child Browse files
Show More
@@ -1,36 +1,35
1 1 #!/usr/bin/env python3
2 2
3 3 # Filter output by pyflakes to control which warnings we check
4 4
5 5
6 6 import re
7 7 import sys
8 8
9 9 lines = []
10 10 for line in sys.stdin:
11 11 # We blacklist tests that are too noisy for us
12 12 pats = [
13 13 r"undefined name 'WindowsError'",
14 14 r"redefinition of unused '[^']+' from line",
15 15 # for cffi, allow re-exports from pure.*
16 16 r"cffi/[^:]*:.*\bimport \*' used",
17 17 r"cffi/[^:]*:.*\*' imported but unused",
18 18 ]
19 19
20 20 keep = True
21 21 for pat in pats:
22 22 if re.search(pat, line):
23 23 keep = False
24 24 break # pattern matches
25 25 if keep:
26 26 fn = line.split(':', 1)[0]
27 f = open(fn)
28 data = f.read()
29 f.close()
30 if 'no-' 'check-code' in data:
27 with open(fn, 'rb') as f:
28 data = f.read()
29 if b'no-' b'check-code' in data:
31 30 continue
32 31 lines.append(line)
33 32
34 33 for line in lines:
35 34 sys.stdout.write(line)
36 35 print()
General Comments 0
You need to be logged in to leave comments. Login now