Fix sanity tests that are failing with LC_ALL set (#58604)

pull/58683/head
Matt Martz 5 years ago committed by GitHub
parent a9fcd1d197
commit 0e9cfd3ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,7 +41,7 @@ def main():
if any(path.startswith(p) for p in prune): if any(path.startswith(p) for p in prune):
continue continue
with open(path, 'r') as path_fd: with open(path, 'rb') as path_fd:
future_ok = None future_ok = None
metaclass_ok = None metaclass_ok = None
@ -51,11 +51,11 @@ def main():
continue continue
for line, text in enumerate(lines): for line, text in enumerate(lines):
if text in ('from __future__ import (absolute_import, division, print_function)', if text in (b'from __future__ import (absolute_import, division, print_function)',
'from __future__ import absolute_import, division, print_function'): b'from __future__ import absolute_import, division, print_function'):
future_ok = line future_ok = line
if text == '__metaclass__ = type': if text == b'__metaclass__ = type':
metaclass_ok = line metaclass_ok = line
if future_ok and metaclass_ok: if future_ok and metaclass_ok:

@ -9,7 +9,10 @@ def main():
status = 0 status = 0
for path in sys.argv[1:] or sys.stdin.read().splitlines(): for path in sys.argv[1:] or sys.stdin.read().splitlines():
with open(path, 'r') as source_fd: with open(path, 'rb') as source_fd:
if sys.version_info[0] == 3:
source = source_fd.read().decode('utf-8')
else:
source = source_fd.read() source = source_fd.read()
try: try:

Loading…
Cancel
Save