Skip to content

Commit 58b4878

Browse files
authored
tests: fix deprecation warnings (#883)
1 parent d3a5a71 commit 58b4878

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/test_factory.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ def test_create_poetry_with_invalid_license_files_glob(
554554
tmp_path: Path, invalid_glob: str, expected_message: str
555555
) -> None:
556556
project_file = tmp_path / "pyproject.toml"
557-
project_file.write_text(f"""\
557+
project_file.write_text(
558+
f"""\
558559
[project]
559560
name = "foo"
560561
version = "1"
@@ -563,7 +564,9 @@ def test_create_poetry_with_invalid_license_files_glob(
563564
"{invalid_glob}",
564565
"licenses/**",
565566
]
566-
""")
567+
""",
568+
encoding="utf-8",
569+
)
567570
with pytest.raises(ValueError) as e:
568571
Factory().create_poetry(tmp_path)
569572
assert str(e.value) == expected_message
@@ -1435,7 +1438,7 @@ def test_create_poetry_with_nested_dependency_groups(
14351438
replace_included_group_name, included_group_name
14361439
)
14371440

1438-
pyproject_toml.write_text(content)
1441+
pyproject_toml.write_text(content, encoding="utf-8")
14391442
poetry = Factory().create_poetry(temporary_directory)
14401443

14411444
# Groups are reported internally using their canonical names.
@@ -1464,7 +1467,7 @@ def assert_invalid_group_including(
14641467
temporary_directory: Path,
14651468
) -> None:
14661469
pyproject_toml = temporary_directory / "pyproject.toml"
1467-
pyproject_toml.write_text(toml_data)
1470+
pyproject_toml.write_text(toml_data, encoding="utf-8")
14681471

14691472
with pytest.raises(error_type) as error:
14701473
_ = Factory().create_poetry(temporary_directory)
@@ -1689,7 +1692,7 @@ def test_create_poetry_with_shared_dependency_groups(
16891692
quux = "*"
16901693
"""
16911694
pyproject_toml = temporary_directory / "pyproject.toml"
1692-
pyproject_toml.write_text(content)
1695+
pyproject_toml.write_text(content, encoding="utf-8")
16931696
poetry = Factory().create_poetry(temporary_directory)
16941697

16951698
assert len(poetry.package.all_requires) == 10
@@ -1760,7 +1763,7 @@ def test_create_poetry_with_shared_dependency_groups_more_complicated(
17601763
quux = "*"
17611764
"""
17621765
pyproject_toml = temporary_directory / "pyproject.toml"
1763-
pyproject_toml.write_text(content)
1766+
pyproject_toml.write_text(content, encoding="utf-8")
17641767
poetry = Factory().create_poetry(temporary_directory)
17651768

17661769
assert len(poetry.package.all_requires) == 14
@@ -1952,7 +1955,7 @@ def test_create_poetry_with_included_groups_only(temporary_directory: Path) -> N
19521955
"testing",
19531956
]
19541957
"""
1955-
pyproject_toml.write_text(content)
1958+
pyproject_toml.write_text(content, encoding="utf-8")
19561959

19571960
poetry = Factory().create_poetry(temporary_directory)
19581961
assert len(poetry.package.all_requires) == 4
@@ -1988,7 +1991,7 @@ def test_create_poetry_with_nested_similar_dependencies(
19881991
19891992
"""
19901993

1991-
pyproject_toml.write_text(content)
1994+
pyproject_toml.write_text(content, encoding="utf-8")
19921995

19931996
poetry = Factory().create_poetry(temporary_directory)
19941997
assert len(poetry.package.all_requires) == 3

0 commit comments

Comments
 (0)