diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-10-18 11:56:21 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-10-20 16:06:39 +0200 |
commit | a4e075f66833d08fc426c9406eb3894ec56326c1 (patch) | |
tree | e7cc21378df81dcb45714030d5eacbbdb9e40568 /test/testpy | |
parent | 425357a11c40f3f6d39dba85feb8533ad038aa6e (diff) | |
download | android-node-v8-a4e075f66833d08fc426c9406eb3894ec56326c1.tar.gz android-node-v8-a4e075f66833d08fc426c9406eb3894ec56326c1.tar.bz2 android-node-v8-a4e075f66833d08fc426c9406eb3894ec56326c1.zip |
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 <riclau@uk.ibm.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/testpy')
-rw-r--r-- | test/testpy/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
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() |