Skip to content

Commit c646680

Browse files
committed
Use binary mode when 'touch'-ing files in test_build_py and test_build_meta
1 parent 31ff4dd commit c646680

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

setuptools/tests/test_build_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def test_build_with_existing_file_present(self, build_type, tmpdir_cwd):
306306
assert first_result != second_result
307307

308308
# And if rebuilding the exact same sdist/wheel?
309-
open(os.path.join(dist_dir, second_result), 'w', encoding="utf-8").close()
309+
open(os.path.join(dist_dir, second_result), 'wb').close()
310310
third_result = build_method(dist_dir)
311311
assert third_result == second_result
312312
assert os.path.getsize(os.path.join(dist_dir, third_result)) > 0

setuptools/tests/test_build_py.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_recursive_in_package_data_glob(tmpdir_cwd):
4949
)
5050
)
5151
os.makedirs('path/subpath/subsubpath')
52-
open('path/subpath/subsubpath/data', 'w', encoding="utf-8").close()
52+
open('path/subpath/subsubpath/data', 'wb').close()
5353

5454
dist.parse_command_line()
5555
dist.run_commands()
@@ -77,8 +77,8 @@ def test_read_only(tmpdir_cwd):
7777
)
7878
)
7979
os.makedirs('pkg')
80-
open('pkg/__init__.py', 'w', encoding="utf-8").close()
81-
open('pkg/data.dat', 'w', encoding="utf-8").close()
80+
open('pkg/__init__.py', 'wb').close()
81+
open('pkg/data.dat', 'wb').close()
8282
os.chmod('pkg/__init__.py', stat.S_IREAD)
8383
os.chmod('pkg/data.dat', stat.S_IREAD)
8484
dist.parse_command_line()
@@ -108,8 +108,8 @@ def test_executable_data(tmpdir_cwd):
108108
)
109109
)
110110
os.makedirs('pkg')
111-
open('pkg/__init__.py', 'w', encoding="utf-8").close()
112-
open('pkg/run-me', 'w', encoding="utf-8").close()
111+
open('pkg/__init__.py', 'wb').close()
112+
open('pkg/run-me', 'wb').close()
113113
os.chmod('pkg/run-me', 0o700)
114114

115115
dist.parse_command_line()

0 commit comments

Comments
 (0)