From a4e075f66833d08fc426c9406eb3894ec56326c1 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Fri, 18 Oct 2019 11:56:21 +0200 Subject: test: fix test runner for Python 3 on Windows Explicitly open files with utf8 encoding, otherwise the system could use another encoding such as latin1 by default. PR-URL: https://github.com/nodejs/node/pull/30023 Reviewed-By: Richard Lau Reviewed-By: Christian Clauss Reviewed-By: Luigi Pinca --- test/testpy/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/testpy') diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 9c70e18d6a..c89ab6e8b5 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -29,6 +29,7 @@ import test import os import re from functools import reduce +from io import open FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") @@ -56,7 +57,7 @@ class SimpleTestCase(test.TestCase): def GetCommand(self): result = [self.config.context.GetVm(self.arch, self.mode)] - source = open(self.file).read() + source = open(self.file, encoding='utf8').read() flags_match = FLAGS_PATTERN.search(source) if flags_match: flags = flags_match.group(1).strip().split() -- cgit v1.2.3