diff options
| author | Steve Kowalik <steven@wedontsleep.org> | 2015-12-10 11:37:29 +1300 |
|---|---|---|
| committer | Steve Kowalik <steven@wedontsleep.org> | 2015-12-10 11:37:29 +1300 |
| commit | 792edda4143317996f83ac5f1ae0db0695173397 (patch) | |
| tree | 2fb5ddca2484116572fc1142a8fb51e052c1be75 /setuptools/tests | |
| parent | a718819d2849196e902808301c9a95724510c5c1 (diff) | |
| parent | 81ca4fea9e4672f39864439f2049108ad731c8fa (diff) | |
| download | python-setuptools-git-792edda4143317996f83ac5f1ae0db0695173397.tar.gz | |
Merge from master.
Diffstat (limited to 'setuptools/tests')
| -rw-r--r-- | setuptools/tests/test_sdist.py | 18 |
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') |
