Github Pr.Run Related Tests
БесплатноБез исполняемых скриптовНе проверенFind and run the tests related to the code changed by a PR
от gpsaggese★ 158 звёзд на GitHubОб этом скилле
Goal
- Given a PR, find the set of test files to run, run them on all the builds, and report the failures
Workflow
Resolve the Input
- Resolve the argument following
.claude/skills/github_pr.rules.md## Resolve the PR Argument - Get the code following
.claude/skills/github_pr.rules.md## Get the Local Code of the PR
Find the Tests
- Get the first selection of test files
> pytest_pr_related_tests.py --pr <PR_NUM> --dry_run - The script saves the selection in
tmp.pytest_pr_related_tests.tests.txt
Complete the Selection
- The test files to run are:
- All the test files modified by the PR
- All the test files corresponding to the code modified by the PR
- When undecided about a test file, run it: running more tests is better than missing a failure
- Do not remove any test file selected by the script
- The script uses text matching, so read the diff and look for the tests it
misses
> gh pr diff <PR_NUM>- Tests of the callers of a modified function, i.e., indirect dependencies
- Tests of code that reads a modified config, template, rules, or data file
- Tests of a module with a name built at run time (e.g.,
importlib)
- Check each file listed under
PR files without related tests- If it can change the behavior of every test (e.g.,
requirements.txt, aDockerfile, a submodule pointer), pass--extra_targets .
- If it can change the behavior of every test (e.g.,
Run the Tests
- Run the selection, passing the test files that you added
> pytest_pr_related_tests.py --pr <PR_NUM> \ --extra_targets <TEST_FILE_1> <TEST_FILE_2> 2>&1 \ | tee tmp.github_pr.run_related_tests.log- Omit
--extra_targetsif there is nothing to add - Run in the background and wait for the script to terminate, since it runs the tests once per build
- Omit
- The script calls
pytest_multi_build.py, which callspytest_failed_multi_build.pyat the end
Check the Results
- The exit code does not report test failures: read the tables at the end of the log
- To print the summary again
> pytest_failed_multi_build.py - Use
tmp.pytest_failed_multi_build.repro.shto reproduce the failures
Report
- Save the report to
github_pr.run_related_tests.<INPUT_REF>.mdin the current dir<INPUT_REF>isPR<PR_NUM>, or<BRANCH_NAME>if there is no PR, as in.claude/skills/skill.rules.md### Name the Output File
- Say in the file how it was generated, with this line right after the title:
- Generated by `.claude/skills/github_pr.run_related_tests/SKILL.md` - Print the report and the path of the file. The report has:
- Number of test files run, and the ones added to the script selection
- Status of each build
- Failed tests with the builds where they fail
- Do not fix the failures: suggest
/pytest.fix_local_tests - Do not comment on the PR unless the user asks for it
Conventions
.claude/skills/github.rules.md.claude/skills/github_pr.rules.md.claude/skills/pytest.rules.md
Verification
- The output file is
github_pr.run_related_tests.<INPUT_REF>.mdin the current dir and has theGenerated byline - Every test file modified by the PR is in the selection
- Every build in the
Build Statisticstable isDONE - The report lists every failed test of
tmp.pytest_failed_multi_build.failed_tests.txt
Установить Github Pr.Run Related Tests в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Github Pr.Run Related Tests?
Find and run the tests related to the code changed by a PR
Как установить скилл Github Pr.Run Related Tests?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Github Pr.Run Related Tests запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic