Skip to content

Commit 3f033f6

Browse files
Add more tests for usethis tool ruff (#52)
1 parent 8694c77 commit 3f033f6

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/abravalheri/validate-pyproject
3-
rev: "v0.21"
3+
rev: "v0.22"
44
hooks:
55
- id: validate-pyproject
66
additional_dependencies: ["validate-pyproject-schema-store[all]"]

src/usethis/_integrations/pre_commit/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
additional_dependencies: ["validate-pyproject-schema-store[all]"]
1414
"""
1515
# Manually bump this version when necessary
16-
_VALIDATEPYPROJECT_VERSION = "v0.21"
16+
_VALIDATEPYPROJECT_VERSION = "v0.22"
1717

1818

1919
def add_pre_commit_config() -> None:

tests/usethis/_interface/test_tool.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,38 @@ def test_config_file(self, uv_init_dir: Path):
405405
# Assert
406406
assert (uv_init_dir / "pyproject.toml").read_text() == ""
407407

408+
def test_blank_slate(self, uv_init_dir: Path):
409+
# Arrange
410+
contents = (uv_init_dir / "pyproject.toml").read_text()
411+
412+
# Act
413+
with change_cwd(uv_init_dir):
414+
_ruff(remove=True, offline=is_offline())
415+
416+
# Assert
417+
assert (uv_init_dir / "pyproject.toml").read_text() == contents
418+
419+
def test_roundtrip(self, uv_init_dir: Path):
420+
# Arrange
421+
contents = (uv_init_dir / "pyproject.toml").read_text()
422+
423+
# Act
424+
with change_cwd(uv_init_dir):
425+
_ruff(offline=is_offline())
426+
_ruff(remove=True, offline=is_offline())
427+
428+
# Assert
429+
assert (
430+
(uv_init_dir / "pyproject.toml").read_text()
431+
== contents
432+
+ """\
433+
434+
[tool.uv]
435+
dev-dependencies = []
436+
437+
"""
438+
)
439+
408440

409441
class TestPytest:
410442
def test_dep(self, uv_init_dir: Path):

0 commit comments

Comments
 (0)