Merged in [16562] from rcross@amsl.com:

Added encoding='utf-8' parameter to io.open operations in tests that starting failing since adding unicode_literals.
 - Legacy-Id: 16588
Note: SVN reference [16562] has been migrated to Git commit d332bfd91d
This commit is contained in:
Henrik Levkowetz 2019-07-24 23:44:36 +00:00
commit 0a591e4b2e
2 changed files with 2 additions and 2 deletions

View file

@ -417,7 +417,7 @@ class EditCharterTests(TestCase):
self.assertEqual(charter.rev, next_revision(prev_rev))
self.assertTrue("new_revision" in charter.latest_event().type)
with io.open(os.path.join(self.charter_dir, charter.canonical_name() + "-" + charter.rev + ".txt")) as f:
with io.open(os.path.join(self.charter_dir, charter.canonical_name() + "-" + charter.rev + ".txt"), encoding='utf-8') as f:
self.assertEqual(f.read(), "Windows line\nMac line\nUnix line\n" + utf_8_snippet.decode('utf-8'))
def test_submit_initial_charter(self):

View file

@ -267,7 +267,7 @@ class CoverageReporter(Reporter):
analysis = self.coverage._analyze(fr)
nums = analysis.numbers
missing_nums = sorted(analysis.missing)
with io.open(analysis.filename) as file:
with io.open(analysis.filename, encoding='utf-8') as file:
lines = file.read().splitlines()
missing_lines = [ lines[l-1] for l in missing_nums ]
result["covered"][fr.relative_filename()] = (nums.n_statements, nums.pc_covered/100.0, missing_nums, missing_lines)