| [ Web Proxy ] |
| Viewing: https://python-version-patch-pr.kitgrid.dev/docs/testing | [Back] [Original] |
[CPython Patch PR Action logo] CPython Patch PR Action Workflows Configuration Examples Troubleshooting
GitHub
Documentation
Reference docs for the CPython Patch PR Action.
The repository relies on Vitest for fast, isolated unit tests plus a handful of integration-style suites that exercise file IO and Octokit boundaries through dependency injection.
npm run test
npm run test:watch during development.--coverage (npx vitest run --coverage) when you need detailed instrumentation via V8.| File | Focus |
|---|---|
tests/scanner*.test.ts |
Glob discovery, regex coverage, and failure modes (missing files, permission errors). |
tests/python-version-patterns.test.ts |
Exhaustive coverage for every detector in pythonVersionPatterns. |
tests/latest-patch-resolver.test.ts, tests/python-org-fallback.test.ts, tests/runner-availability.test.ts |
Version resolution + offline snapshot handling. |
tests/action-execution.test.ts |
End-to-end flow using stubbed dependencies to verify skip reasons, workflow permission gates, and runner enforcement. |
tests/git-*.test.ts |
Branch management and pull-request logic using mocked execFile / Octokit clients. |
tests/rewriter suites (patch, dry-run, idempotence) |
Ensures in-place replacements behave deterministically and avoid cross-track edits. |
tests/pr-body.test.ts |
Makes sure the generated Markdown stays stable. |
tests/coexistence-configs.test.ts |
Validates the Renovate/Dependabot guidance shipped in examples/coexistence/. |
Fixtures live under tests/fixtures/** and are intentionally small. Add new fixtures when you need to represent additional config shapes or file types.
ExecuteDependencies. This allows you to stub network calls, Octokit, and filesystem interactions without complex setup.tests/fixtures and load them with readFileSync to keep expectations realistic.tests/action-execution.test.ts to cover both the positive path and the new failure mode.CI should run npm run lint and npm run format (or the write variants) alongside tests to keep TypeScript, Vitest, and documentation tidy. The lint script already targets both src/ and tests/ so new tests automatically fall under lint coverage.
On this page
| Web Proxy Viewer | New URL | Original Page |