aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_sdist.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-09 03:34:35 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-09 03:34:35 -0500
commit41112f5afd0d2b0c14899ab1cf2c27183e64d6ac (patch)
tree81c6998dea813de0f146b2c58125f1226cbadad3 /setuptools/tests/test_sdist.py
parent1c7e97f95ea74c241b91dfb975c709940ba00f47 (diff)
downloadexternal_python_setuptools-41112f5afd0d2b0c14899ab1cf2c27183e64d6ac.tar.gz
external_python_setuptools-41112f5afd0d2b0c14899ab1cf2c27183e64d6ac.tar.bz2
external_python_setuptools-41112f5afd0d2b0c14899ab1cf2c27183e64d6ac.zip
Use io.open for future compatibility and consistency
Diffstat (limited to 'setuptools/tests/test_sdist.py')
-rw-r--r--setuptools/tests/test_sdist.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index ec3c8aa9..8ec9a4cb 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -7,6 +7,7 @@ import sys
import tempfile
import unicodedata
import contextlib
+import io
import pytest
@@ -81,6 +82,11 @@ def decompose(path):
return path
+def read_all_bytes(filename):
+ with io.open(filename, 'rb') as fp:
+ return fp.read()
+
+
class TestSdistTest:
def setup_method(self, method):
@@ -172,9 +178,7 @@ class TestSdistTest:
mm.filelist.append(filename)
mm.write_manifest()
- manifest = open(mm.manifest, 'rbU')
- contents = manifest.read()
- manifest.close()
+ contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
u_contents = contents.decode('UTF-8')
@@ -210,9 +214,7 @@ class TestSdistTest:
# Re-write manifest
mm.write_manifest()
- manifest = open(mm.manifest, 'rbU')
- contents = manifest.read()
- manifest.close()
+ contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
contents.decode('UTF-8')
@@ -248,9 +250,7 @@ class TestSdistTest:
# Re-write manifest
mm.write_manifest()
- manifest = open(mm.manifest, 'rbU')
- contents = manifest.read()
- manifest.close()
+ contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
contents.decode('UTF-8')