@@ -216,11 +216,13 @@ def test_dynamic(self, tmp_path):
216
216
# Let's create a project example that has dynamic classifiers
217
217
# coming from a txt file.
218
218
create_example (tmp_path , "src" )
219
- classifiers = """\
220
- Framework :: Flask
221
- Programming Language :: Haskell
222
- """
223
- (tmp_path / "classifiers.txt" ).write_text (cleandoc (classifiers ))
219
+ classifiers = cleandoc (
220
+ """
221
+ Framework :: Flask
222
+ Programming Language :: Haskell
223
+ """
224
+ )
225
+ (tmp_path / "classifiers.txt" ).write_text (classifiers , encoding = "utf-8" )
224
226
225
227
pyproject = tmp_path / "pyproject.toml"
226
228
config = read_configuration (pyproject , expand = False )
@@ -248,7 +250,7 @@ def test_dynamic_without_config(self, tmp_path):
248
250
"""
249
251
250
252
pyproject = tmp_path / "pyproject.toml"
251
- pyproject .write_text (cleandoc (config ))
253
+ pyproject .write_text (cleandoc (config ), encoding = "utf-8" )
252
254
with pytest .raises (OptionError , match = "No configuration .* .classifiers." ):
253
255
read_configuration (pyproject )
254
256
@@ -260,7 +262,7 @@ def test_dynamic_readme_from_setup_script_args(self, tmp_path):
260
262
dynamic = ["readme"]
261
263
"""
262
264
pyproject = tmp_path / "pyproject.toml"
263
- pyproject .write_text (cleandoc (config ))
265
+ pyproject .write_text (cleandoc (config ), encoding = "utf-8" )
264
266
dist = Distribution (attrs = {"long_description" : "42" })
265
267
# No error should occur because of missing `readme`
266
268
dist = apply_configuration (dist , pyproject )
@@ -278,7 +280,7 @@ def test_dynamic_without_file(self, tmp_path):
278
280
"""
279
281
280
282
pyproject = tmp_path / "pyproject.toml"
281
- pyproject .write_text (cleandoc (config ))
283
+ pyproject .write_text (cleandoc (config ), encoding = "utf-8" )
282
284
with pytest .warns (UserWarning , match = "File .*classifiers.txt. cannot be found" ):
283
285
expanded = read_configuration (pyproject )
284
286
assert "classifiers" not in expanded ["project" ]
@@ -299,7 +301,7 @@ def test_dynamic_without_file(self, tmp_path):
299
301
)
300
302
def test_ignore_unrelated_config (tmp_path , example ):
301
303
pyproject = tmp_path / "pyproject.toml"
302
- pyproject .write_text (cleandoc (example ))
304
+ pyproject .write_text (cleandoc (example ), encoding = "utf-8" )
303
305
304
306
# Make sure no error is raised due to 3rd party configs in pyproject.toml
305
307
assert read_configuration (pyproject ) is not None
@@ -321,7 +323,7 @@ def test_ignore_unrelated_config(tmp_path, example):
321
323
)
322
324
def test_invalid_example (tmp_path , example , error_msg ):
323
325
pyproject = tmp_path / "pyproject.toml"
324
- pyproject .write_text (cleandoc (example ))
326
+ pyproject .write_text (cleandoc (example ), encoding = "utf-8" )
325
327
326
328
pattern = re .compile (f"invalid pyproject.toml.*{ error_msg } .*" , re .M | re .S )
327
329
with pytest .raises (ValueError , match = pattern ):
@@ -331,7 +333,7 @@ def test_invalid_example(tmp_path, example, error_msg):
331
333
@pytest .mark .parametrize ("config" , ("" , "[tool.something]\n value = 42" ))
332
334
def test_empty (tmp_path , config ):
333
335
pyproject = tmp_path / "pyproject.toml"
334
- pyproject .write_text (config )
336
+ pyproject .write_text (config , encoding = "utf-8" )
335
337
336
338
# Make sure no error is raised
337
339
assert read_configuration (pyproject ) == {}
@@ -343,7 +345,7 @@ def test_include_package_data_by_default(tmp_path, config):
343
345
default.
344
346
"""
345
347
pyproject = tmp_path / "pyproject.toml"
346
- pyproject .write_text (config )
348
+ pyproject .write_text (config , encoding = "utf-8" )
347
349
348
350
config = read_configuration (pyproject )
349
351
assert config ["tool" ]["setuptools" ]["include-package-data" ] is True
0 commit comments