don't require tests for non-utf8 filesystem encoding

This commit is contained in:
Alan Hamlett 2015-09-08 14:07:14 -07:00
parent 8b179730fb
commit 68436b5700

View file

@ -148,7 +148,7 @@ def number_lines_in_file(file_name):
with open(file_name, 'r', encoding='utf-8') as fh: with open(file_name, 'r', encoding='utf-8') as fh:
for line in fh: for line in fh:
lines += 1 lines += 1
except: except: # pragma: nocover
try: try:
with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh: with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh:
for line in fh: for line in fh:
@ -189,7 +189,7 @@ def get_file_contents(file_name):
try: try:
with open(file_name, 'r', encoding='utf-8') as fh: with open(file_name, 'r', encoding='utf-8') as fh:
text = fh.read(512000) text = fh.read(512000)
except: except: # pragma: nocover
try: try:
with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh: with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh:
text = fh.read(512000) text = fh.read(512000)