Skip to content

Commit

Permalink
Add more tests for usethis tool ruff (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjmcdougall committed Oct 28, 2024
1 parent a347021 commit 483e31f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.21"
rev: "v0.22"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]
Expand Down
2 changes: 1 addition & 1 deletion src/usethis/_integrations/pre_commit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
additional_dependencies: ["validate-pyproject-schema-store[all]"]
"""
# Manually bump this version when necessary
_VALIDATEPYPROJECT_VERSION = "v0.21"
_VALIDATEPYPROJECT_VERSION = "v0.22"


def add_pre_commit_config() -> None:
Expand Down
32 changes: 32 additions & 0 deletions tests/usethis/_interface/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,38 @@ def test_config_file(self, uv_init_dir: Path):
# Assert
assert (uv_init_dir / "pyproject.toml").read_text() == ""

def test_blank_slate(self, uv_init_dir: Path):
# Arrange
contents = (uv_init_dir / "pyproject.toml").read_text()

# Act
with change_cwd(uv_init_dir):
_ruff(remove=True, offline=is_offline())

# Assert
assert (uv_init_dir / "pyproject.toml").read_text() == contents

def test_roundtrip(self, uv_init_dir: Path):
# Arrange
contents = (uv_init_dir / "pyproject.toml").read_text()

# Act
with change_cwd(uv_init_dir):
_ruff(offline=is_offline())
_ruff(remove=True, offline=is_offline())

# Assert
assert (
(uv_init_dir / "pyproject.toml").read_text()
== contents
+ """\
[tool.uv]
dev-dependencies = []
"""
)


class TestPytest:
def test_dep(self, uv_init_dir: Path):
Expand Down

0 comments on commit 483e31f

Please sign in to comment.