Skip to content

Add parameterized test for adding each tool and running its standard command#1652

Open
Copilot wants to merge 3 commits intomainfrom
copilot/create-parameterized-test-for-tool
Open

Add parameterized test for adding each tool and running its standard command#1652
Copilot wants to merge 3 commits intomainfrom
copilot/create-parameterized-test-for-tool

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

Centralizes tool "add then run" testing into a single parameterized test over ALL_TOOLS instead of scattered per-tool tests.

Changes

  • New TestUseTool.test_runs — parameterized over ALL_TOOLS, calls use_tool(tool) then runs tool.raw_cmd() via call_uv_subprocess on a fresh uv project
    • Tools without raw_cmd() (Coverage.py, MkDocs, pyproject.toml, requirements.txt, Ruff) skip via NoDefaultToolCommand
    • Pytest gets a placeholder test file to avoid exit code 5
  • Removed TestCodespell.TestAdd.test_runs — now redundant with the parameterized test
  • UI-level test_runs methods in test_tool.py kept (different test layer — CLI interface)
@pytest.mark.parametrize("tool", ALL_TOOLS, ids=lambda t: t.name)
@pytest.mark.usefixtures("_vary_network_conn")
def test_runs(self, tool: SupportedToolType, uv_env_dir: Path):
    with change_cwd(uv_env_dir), files_manager():
        use_tool(tool)
        try:
            cmd = tool.raw_cmd()
        except NoDefaultToolCommand:
            pytest.skip(f"{tool.name} has no default command")
        if isinstance(tool, PytestTool):
            (uv_env_dir / "tests" / "test_placeholder.py").write_text(
                "def test_placeholder(): pass\n"
            )
        call_uv_subprocess(["run", *shlex.split(cmd)], change_toml=False)

Also includes a pre-existing docs/functions.txt / AGENTS.md sync fix picked up by prek.

Copilot AI and others added 2 commits March 30, 2026 22:22
…mmands

Iterate over ALL_TOOLS, add each via use_tool(), then run via raw_cmd().
Tools without raw_cmd() are skipped. Pytest gets a placeholder test file
to avoid exit code 5. Remove redundant TestCodespell.TestAdd.test_runs.

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/7447c0e1-63ff-4478-bd44-52a2ff1af7d2

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Add parameterized test for adding and running a tool Add parameterized test for adding each tool and running its standard command Mar 30, 2026
Copilot AI requested a review from nathanjmcdougall March 30, 2026 22:26
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 30, 2026 22:49
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 30, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/create-parameterized-test-for-tool (5922000) with main (b438c90)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a standard (parameterized) test for adding a tool & running it

2 participants