diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-08-19 22:48:46 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-08-19 22:48:46 (GMT) |
commit | e4d35dc8b6fb3c071d85e2d8830566876288c180 (patch) | |
tree | c313b3e57ef51885e238f3fed931e6dac8255eb7 /Lib/test/test_linecache.py | |
parent | dc7756599025ea28f917393e34bd0c922cc1166e (diff) | |
download | cpython-e4d35dc8b6fb3c071d85e2d8830566876288c180.zip cpython-e4d35dc8b6fb3c071d85e2d8830566876288c180.tar.gz cpython-e4d35dc8b6fb3c071d85e2d8830566876288c180.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_linecache.py')
-rw-r--r-- | 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 index e74aef3..240db7f 100644 --- a/Lib/test/test_linecache.py +++ b/Lib/test/test_linecache.py @@ -4,6 +4,7 @@ import linecache import unittest import os.path import tempfile +import tokenize from test import support @@ -54,7 +55,7 @@ class GetLineTestsGoodData(TempFile): 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' |