[Python-checkins] cpython: Fix test_linecache change.
robert.collins
python-checkins at python.org
Thu Aug 20 00:48:56 CEST 2015
https://hg.python.org/cpython/rev/2a0c04260bd4
changeset: 97459:2a0c04260bd4
user: Robert Collins <rbtcollins at hp.com>
date: Thu Aug 20 10:48:46 2015 +1200
summary:
Fix test_linecache change.
In non-UTF8 locales open() will have the wrong encoding for the test
data. We need to open the file via tokenize, to get a detected
encoding instead.
files:
Lib/test/test_linecache.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py
--- a/Lib/test/test_linecache.py
+++ b/Lib/test/test_linecache.py
@@ -4,6 +4,7 @@
import unittest
import os.path
import tempfile
+import tokenize
from test import support
@@ -54,7 +55,7 @@
super().setUp()
def test_getline(self):
- with open(self.file_name) as fp:
+ with tokenize.open(self.file_name) as fp:
for index, line in enumerate(fp):
if not line.endswith('\n'):
line += '\n'
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list