diff options
Diffstat (limited to 'test/RegressTests.py')
-rwxr-xr-x | test/RegressTests.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/RegressTests.py b/test/RegressTests.py index 9d8a7af9..7395a4c1 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals +from io import open import sys import os @@ -40,11 +41,11 @@ if not os.path.isdir(tests) and not os.path.isfile(tests): class RegressFile(object): def __init__(self, filename): self.filename = filename - self.fd = open(self.filename) + self.fd = open(self.filename, encoding='utf-8') def transform_line(self, line): - line = re.sub('\$sourcepath', harness.sourcepath, line) - line = re.sub('\$FILE', os.path.abspath(self.filename), line) + line = line.replace('$sourcepath', harness.sourcepath) + line = line.replace('$FILE', os.path.abspath(self.filename)) return line def read_test(self): @@ -123,7 +124,7 @@ class RegressFile(object): columns=(not re.search('--columns', test['command']))) if use_stdin: - fd = open(self.filename) + fd = open(self.filename, encoding='utf-8') try: stdin = fd.read() if sys.version_info.major > 2: @@ -168,6 +169,7 @@ class RegressFile(object): if sys.platform == 'win32': process_error = [l.replace('\r\n', '\n').replace('\\', '/') for l in process_error] + test['error'] = [l.replace('\\', '/') for l in test['error']] for line in unified_diff(test['error'], process_error): index += 1 if index < 3: |