From 10ad302e2f2c654f33c451763be69554167af308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 25 Feb 2016 09:53:32 +0100 Subject: [PATCH] Tests: Explicit encoding for spec examples YAML specification examples contain unusual characters, let's explicit `encoding='utf-8'` to prevent bugs. --- tests/test_spec_examples.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_spec_examples.py b/tests/test_spec_examples.py index c8f323d..8d18cde 100644 --- a/tests/test_spec_examples.py +++ b/tests/test_spec_examples.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from io import open import os from tests.common import RuleTestCase @@ -178,7 +179,7 @@ for file in files: if file in pyyaml_blacklist: continue - with open('tests/yaml-1.2-spec-examples/' + file) as f: + with open('tests/yaml-1.2-spec-examples/' + file, encoding='utf-8') as f: conf = conf_general + conf_overrides.get(file, '') setattr(SpecificationTestCase, 'test_' + file, _gen_test(f.read(), conf))