diff options
author | Denis Laxalde <denis.laxalde@logilab.fr> | 2017-07-04 09:24:36 +0200 |
---|---|---|
committer | Denis Laxalde <denis.laxalde@logilab.fr> | 2017-07-04 09:24:36 +0200 |
commit | 6a832d17a3555c652d5530625a40f73c69441720 (patch) | |
tree | 1e8aa87e32e53a77b2994c4e9b299d1ab6ba608d /test | |
parent | 57c1a89bc7ef582a85f291c976c932c59062a1ce (diff) | |
download | logilab-common-6a832d17a3555c652d5530625a40f73c69441720.tar.gz |
Use io.open() to avoid deprecation warning about 'U' mode
Use io.open() which has a consistent interface between Python 2 and Python 3.
In particular, `newline` parameter is meant to control "universal new lines"
and it is None by default so we don't need to specify it.
Diffstat (limited to 'test')
-rw-r--r-- | test/unittest_fileutils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/unittest_fileutils.py b/test/unittest_fileutils.py index 80cefe4..a43b60f 100644 --- a/test/unittest_fileutils.py +++ b/test/unittest_fileutils.py @@ -18,6 +18,7 @@ """unit tests for logilab.common.fileutils""" import doctest +import io import sys, os, tempfile, shutil from stat import S_IWRITE from os.path import join @@ -54,7 +55,7 @@ class GetModeTC(TestCase): class NormReadTC(TestCase): def test_known_values_norm_read(self): - data = open(NEWLINES_TXT, 'U').read() + data = io.open(NEWLINES_TXT).read() self.assertEqual(data.strip(), '\n'.join(['# mixed new lines', '1', '2', '3'])) |