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