From d332bfd91de5dc8b76a32a015cc30dd7e1546622 Mon Sep 17 00:00:00 2001 From: Ryan Cross Date: Sat, 20 Jul 2019 22:54:14 +0000 Subject: [PATCH] Added encoding='utf-8' parameter to io.open operations in tests that starting failing since adding unicode_literals. Commit ready to merge - Legacy-Id: 16562 --- ietf/doc/tests_charter.py | 2 +- ietf/utils/test_runner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ietf/doc/tests_charter.py b/ietf/doc/tests_charter.py index f3333a830..199053260 100644 --- a/ietf/doc/tests_charter.py +++ b/ietf/doc/tests_charter.py @@ -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): diff --git a/ietf/utils/test_runner.py b/ietf/utils/test_runner.py index b444b25c4..86a9fd141 100644 --- a/ietf/utils/test_runner.py +++ b/ietf/utils/test_runner.py @@ -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)