Skip to content

test(gh-issues): add unit, integration, and smoke tests for gh_issues.py (#99) - #129

Merged
c-vigo merged 10 commits into
devfrom
feature/99-just-gh-issues-overview-test-coverage
Feb 21, 2026
Merged

c-vigo merged 10 commits into
devfrom
feature/99-just-gh-issues-overview-test-coverage

Conversation

@gerchowl

Copy link
Copy Markdown
Contributor

Pull Request

Description

Add comprehensive test coverage for scripts/gh_issues.py across three layers: unit tests for pure-logic functions, container integration tests for runtime dependency verification, and an integration smoke test for the just gh-issues recipe. The smoke test uncovered a missing rich dependency in the workspace template pyproject.toml, which is also fixed here.

Related Issue(s)

Closes #99

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • CI / Build change
  • Test updates

Changes Made

  • 57 unit tests (tests/test_gh_issues.py) covering all 9 pure-logic functions: _styled, _extract_label, _extract_type, _extract_scope, _clean_title, _format_assignees, _infer_review, _extract_reviewers, _build_cross_refs
  • 2 container integration tests (tests/test_image.py) verifying rich importability and gh_issues.py importability inside the container image
  • 1 smoke test (tests/test_integration.py) running just gh-issues in a devcontainer, validating the full recipe wiring end-to-end
  • Bug fix: added rich>=13.0 to assets/workspace/pyproject.toml dependencies — uv run python in the project venv couldn't find rich (only installed system-wide), causing ModuleNotFoundError

Changelog Entry

No changelog needed — tests-only change with no user-visible impact. The rich dependency fix affects the workspace template for new projects only.

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • uv run pytest tests/test_gh_issues.py -v — 57/57 passed
  • uv run pytest tests/test_integration.py::TestGhIssuesSmoke -v -s — skipped (expected: test workspace has no GitHub repo context)
  • Container image rebuilt with just build dev to verify rich dependency fix

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • The smoke test skips when gh CLI calls fail (no repo context in test workspace or no auth). It would fully pass in a workspace with a real GitHub repo and authentication.
  • The existing test_manifest_files already covers file existence and checksum verification for the deployed gh_issues.py via the sync manifest.

57 tests covering all 9 pure-logic functions: _styled,
_extract_label, _extract_type, _extract_scope, _clean_title,
_format_assignees, _infer_review, _extract_reviewers,
_build_cross_refs.

Refs: #99
Verify rich importability and gh_issues.py importability inside the
container image, catching missing dependencies and syntax errors.

Refs: #99
Runs `just gh-issues` inside the devcontainer and verifies it
produces output with issues and pull requests sections. Skips
gracefully when gh auth is not available.

Refs: #99
The gh_issues.py script requires rich at runtime. When invoked via
`uv run python` (as justfile.gh does), the project venv doesn't
include system-installed packages, causing ModuleNotFoundError.

Refs: #99
@gerchowl
gerchowl requested a review from c-vigo as a code owner February 20, 2026 16:40
@gerchowl gerchowl self-assigned this Feb 20, 2026
The image tests used bare python3 to verify rich importability, but rich
is installed in the workspace venv (via pyproject.toml), not system-wide.
Switch to uv run python from the workspace template directory, matching
the actual runtime invocation in justfile.gh.

Refs: #99
Comment thread assets/workspace/pyproject.toml Resolved
The image tests used uv run which re-parses pyproject.toml, but the
template still contains {{SHORT_NAME}} placeholders (replaced only at
workspace init time). Use the pre-built .venv/bin/python directly,
which already has rich installed from the Containerfile uv sync step.

Refs: #99
@c-vigo
c-vigo merged commit 704d0e7 into dev Feb 21, 2026
12 of 13 checks passed
@c-vigo
c-vigo deleted the feature/99-just-gh-issues-overview-test-coverage branch February 21, 2026 17:56
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.

2 participants