Skip to content

Commit

Permalink
Fix sanity tests that are failing with LC_ALL set (ansible#58604)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel authored Jul 2, 2019
1 parent a9fcd1d commit 0e9cfd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/sanity/code-smell/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():
if any(path.startswith(p) for p in prune):
continue

with open(path, 'r') as path_fd:
with open(path, 'rb') as path_fd:
future_ok = None
metaclass_ok = None

Expand All @@ -51,11 +51,11 @@ def main():
continue

for line, text in enumerate(lines):
if text in ('from __future__ import (absolute_import, division, print_function)',
'from __future__ import absolute_import, division, print_function'):
if text in (b'from __future__ import (absolute_import, division, print_function)',
b'from __future__ import absolute_import, division, print_function'):
future_ok = line

if text == '__metaclass__ = type':
if text == b'__metaclass__ = type':
metaclass_ok = line

if future_ok and metaclass_ok:
Expand Down
7 changes: 5 additions & 2 deletions test/sanity/compile/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ def main():
status = 0

for path in sys.argv[1:] or sys.stdin.read().splitlines():
with open(path, 'r') as source_fd:
source = source_fd.read()
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()

try:
parser.suite(source)
Expand Down

0 comments on commit 0e9cfd3

Please sign in to comment.