Skip to content

Commit 62e9919

Browse files
Fix test_init.py: add SetupCFGManager context to TestWriteSimpleRequirementsTxt
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/f7cfd326-fb26-42fa-af09-f0b5d180b7dd Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
1 parent 10be3a5 commit 62e9919

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

tests/usethis/test_init.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from usethis._config_file import files_manager
99
from usethis._file.pyproject_toml.errors import PyprojectTOMLInitError
1010
from usethis._file.pyproject_toml.io_ import PyprojectTOMLManager
11+
from usethis._file.setup_cfg.io_ import SetupCFGManager
1112
from usethis._init import (
1213
_BUILD_SYSTEM_CONFIG,
1314
ensure_pyproject_toml,
@@ -279,7 +280,7 @@ def mock_ensure_pyproject_toml_via_poetry(*, author: bool = True) -> None:
279280
class TestWriteSimpleRequirementsTxt:
280281
def test_no_pyproject_toml(self, tmp_path: Path):
281282
# Act
282-
with change_cwd(tmp_path), PyprojectTOMLManager():
283+
with change_cwd(tmp_path), PyprojectTOMLManager(), SetupCFGManager():
283284
write_simple_requirements_txt()
284285

285286
# Assert
@@ -299,7 +300,7 @@ def test_no_dependencies(self, tmp_path: Path):
299300
)
300301

301302
# Act
302-
with change_cwd(tmp_path), PyprojectTOMLManager():
303+
with change_cwd(tmp_path), PyprojectTOMLManager(), SetupCFGManager():
303304
write_simple_requirements_txt()
304305

305306
# Assert
@@ -322,7 +323,7 @@ def test_with_dependencies(self, tmp_path: Path):
322323
)
323324

324325
# Act
325-
with change_cwd(tmp_path), PyprojectTOMLManager():
326+
with change_cwd(tmp_path), PyprojectTOMLManager(), SetupCFGManager():
326327
write_simple_requirements_txt()
327328

328329
# Assert
@@ -345,7 +346,7 @@ def test_with_dependencies_with_extras(self, tmp_path: Path):
345346
)
346347

347348
# Act
348-
with change_cwd(tmp_path), PyprojectTOMLManager():
349+
with change_cwd(tmp_path), PyprojectTOMLManager(), SetupCFGManager():
349350
write_simple_requirements_txt()
350351

351352
# Assert
@@ -359,7 +360,7 @@ def test_overwrites_existing_file(self, tmp_path: Path):
359360
(tmp_path / "requirements.txt").write_text("old content")
360361

361362
# Act
362-
with change_cwd(tmp_path), PyprojectTOMLManager():
363+
with change_cwd(tmp_path), PyprojectTOMLManager(), SetupCFGManager():
363364
write_simple_requirements_txt()
364365

365366
# Assert

0 commit comments

Comments
 (0)