bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035)

This commit is contained in:
Serhiy Storchaka 2020-06-25 17:56:31 +03:00 committed by GitHub
parent 8ea6353f60
commit 700cfa8c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 110 additions and 77 deletions

View file

@ -80,8 +80,8 @@ class BaseTest(unittest.TestCase):
def get_env_file(self, *args):
return os.path.join(self.env_dir, *args)
def get_text_file_contents(self, *args):
with open(self.get_env_file(*args), 'r') as f:
def get_text_file_contents(self, *args, encoding='utf-8'):
with open(self.get_env_file(*args), 'r', encoding=encoding) as f:
result = f.read()
return result