Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ def usethis_installed_dir(


class TestInstalledInOwnVenv:
@pytest.mark.benchmark
def test_help(self, usethis_installed_dir: Path):
with change_cwd(usethis_installed_dir):
# Should run without error
call_subprocess(["usethis", "--help"])

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_add_pytest(self, usethis_installed_dir: Path):
with change_cwd(usethis_installed_dir):
Expand Down
7 changes: 7 additions & 0 deletions tests/usethis/_core/test_core_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ def test_run_deptry_pass(self, uv_init_dir: Path):
# Assert
call_uv_subprocess(["run", "deptry", "."], change_toml=False)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_pre_commit_after(
self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]
Expand Down Expand Up @@ -1534,6 +1535,7 @@ def test_config_file_already_exists(self, uv_init_repo_dir: Path):
"""
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_bad_commit(self, uv_env_dir: Path, git_path: Path):
# This needs a venv so that we can actually run pre-commit via git
Expand Down Expand Up @@ -1570,6 +1572,7 @@ def test_bad_commit(self, uv_env_dir: Path, git_path: Path):
f"stdout: {result.stdout}\nstderr: {result.stderr}\n"
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_requirements_txt_used(self, uv_init_dir: Path):
with change_cwd(uv_init_dir), files_manager():
Expand Down Expand Up @@ -1672,6 +1675,7 @@ def test_stdout(self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]):
"✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n"
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_requirements_txt_used(
self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]
Expand All @@ -1695,6 +1699,7 @@ def test_requirements_txt_used(
"☐ Run 'uv export --no-default-groups -o=requirements.txt' to write 'requirements.txt'."
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_pyproject_fmt_used(
self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]
Expand Down Expand Up @@ -1774,6 +1779,7 @@ def test_prexisting(self, uv_init_repo_dir: Path):
contents = (uv_init_repo_dir / "bitbucket-pipelines.yml").read_text()
assert "pre-commit" in contents

@pytest.mark.benchmark
def test_remove(self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]):
# Arrange
with change_cwd(uv_init_dir), files_manager():
Expand Down Expand Up @@ -2569,6 +2575,7 @@ def test_start_from_uv_locked(
"☐ Run 'uv export --no-default-groups -o=requirements.txt' to write 'requirements.txt'."
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_pre_commit(
self, uv_init_repo_dir: Path, capfd: pytest.CaptureFixture[str]
Expand Down
6 changes: 6 additions & 0 deletions tests/usethis/_interface/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_how(self, tmp_path: Path):


class TestDeptry:
@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli(self, uv_init_dir: Path):
with change_cwd(uv_init_dir):
Expand All @@ -133,12 +134,14 @@ def test_cli(self, uv_init_dir: Path):
else:
call_subprocess(["usethis", "tool", "deptry", "--offline"])

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli_frozen(self, uv_init_dir: Path):
with change_cwd(uv_init_dir):
call_subprocess(["usethis", "tool", "deptry", "--frozen"])
assert not (uv_init_dir / ".venv").exists()

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli_not_frozen(self, uv_init_dir: Path):
with change_cwd(uv_init_dir):
Expand Down Expand Up @@ -249,6 +252,7 @@ def test_how(self, tmp_path: Path):


class TestPreCommit:
@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli_pass(self, uv_init_repo_dir: Path):
with change_cwd(uv_init_repo_dir):
Expand All @@ -261,6 +265,7 @@ def test_cli_pass(self, uv_init_repo_dir: Path):
["run", "pre-commit", "run", "--all-files"], change_toml=False
)

@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli_fail(self, uv_init_repo_dir: Path):
with change_cwd(uv_init_repo_dir):
Expand Down Expand Up @@ -351,6 +356,7 @@ def test_how(self, tmp_path: Path):


class TestRuff:
@pytest.mark.benchmark
@pytest.mark.usefixtures("_vary_network_conn")
def test_cli(self, uv_init_dir: Path):
with change_cwd(uv_init_dir):
Expand Down
Loading