diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-01-04 20:42:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 20:42:12 -0500 |
commit | c0edf9323c1e124ae34f96ccfb7cf21df0f32252 (patch) | |
tree | 3e2c19e8371c90d3c0d7fbfb6d8122e47def47de /setuptools/tests/files.py | |
parent | 7af7f8a68ea4b0f7d45a739273684832fa609935 (diff) | |
parent | 85747b8ccc2a2da7ecb59c6aff2561c052c463d2 (diff) | |
download | python-setuptools-git-c0edf9323c1e124ae34f96ccfb7cf21df0f32252.tar.gz |
Merge branch 'master' into master
Diffstat (limited to 'setuptools/tests/files.py')
-rw-r--r-- | setuptools/tests/files.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/tests/files.py b/setuptools/tests/files.py index 98de9fc3..75ec740d 100644 --- a/setuptools/tests/files.py +++ b/setuptools/tests/files.py @@ -1,6 +1,7 @@ import os +from pkg_resources.extern.six import binary_type import pkg_resources.py31compat @@ -30,5 +31,9 @@ def build_files(file_defs, prefix=""): pkg_resources.py31compat.makedirs(full_name, exist_ok=True) build_files(contents, prefix=full_name) else: - with open(full_name, 'w') as f: - f.write(contents) + if isinstance(contents, binary_type): + with open(full_name, 'wb') as f: + f.write(contents) + else: + with open(full_name, 'w') as f: + f.write(contents) |