一键导入
running-tests-and-quality-gates
Use when running or interacting with unit tests, code formatters, linters, type checks, pip audit or other quality gates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when running or interacting with unit tests, code formatters, linters, type checks, pip audit or other quality gates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | running-tests-and-quality-gates |
| description | Use when running or interacting with unit tests, code formatters, linters, type checks, pip audit or other quality gates. |
| Check | Command | Single-file alternative |
|---|---|---|
| Unit tests (all) | tox -e test | — |
| Unit tests (single file) | — | tox -e test -- tests/path/to/test_file.py --no-cov |
| Unit tests (single test) | — | tox -e test -- -k test_name --no-cov |
| Unit tests (by path) | — | tox -e test -- tests/path/to/test_file.py::test_name --no-cov |
| Format check | tox -e black | poetry run black --check path/to/file.py |
| Auto-format | tox -e black-format | poetry run black path/to/file.py |
| Type check (strict) | tox -e mypy | poetry run mypy --strict --ignore-missing-imports path/to/file.py |
| Static analysis | tox -e pylint | — |
| Security scan | tox -e bandit | — |
| YAML lint | tox -e yamllint | — |
| Ansible lint | tox -e ansible-lint | — |
| Dockerfile lint | tox -e hadolint | — |
| Dependency audit | tox -e pip-audit | — |
| All checks | tox | — |
Use --no-cov when running single test files or functions — the 100% coverage gate measures the whole package and will fail on partial runs.
Single-file format/type checks use poetry run directly — tox envs other than test do not pass {posargs} to the underlying tool.
For tight iteration, run scoped checks after each change:
tox -e test -- tests/path/to/test_file.py --no-cov # single test file
poetry run black --check path/to/file.py # format check
poetry run mypy --strict --ignore-missing-imports path/to/file.py # type check
Run the full suite (tox) before opening a PR.
Tests mirror the source tree under tests/:
tests/entrypoints/ # mirrors operatorcert/entrypoints/
tests/static_tests/ # mirrors operatorcert/static_tests/
tests/operator_repo/ # mirrors operatorcert/operator_repo/
tests/catalog/ # mirrors operatorcert/catalog/
...
Place new test files in the matching subdirectory. Name them test_<module_name>.py.
--cov-fail-under 100) — new code needs testsAny usage must be explicit