Skip to content

Commit e8afc9d

Browse files
Add tests for get_default_groups
1 parent 640ab6e commit e8afc9d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/usethis/_integrations/uv/test_deps.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,3 +645,30 @@ def test_dev_not_added_if_missing(self, tmp_path: Path):
645645
# Assert
646646
default_groups = get_pyproject_value(["tool", "uv", "default-groups"])
647647
assert set(default_groups) == {"test"}
648+
649+
650+
class TestGetDefaultGroups:
651+
def test_empty_pyproject_toml(self, tmp_path: Path):
652+
# Arrange
653+
(tmp_path / "pyproject.toml").touch()
654+
655+
with change_cwd(tmp_path), PyprojectTOMLManager():
656+
# Act
657+
result = get_default_groups()
658+
659+
# Assert
660+
assert result == []
661+
662+
def test_invalid_default_groups(self, tmp_path: Path):
663+
# Arrange
664+
(tmp_path / "pyproject.toml").write_text("""\
665+
[tool.uv]
666+
default-groups = "not a list"
667+
""")
668+
669+
with change_cwd(tmp_path), PyprojectTOMLManager():
670+
# Act
671+
result = get_default_groups()
672+
673+
# Assert
674+
assert result == []

0 commit comments

Comments
 (0)