Skip to content

M2-T1: Python test infrastructure — pytest + coverage ≥80% #20

Description

@hartsock

Summary

Set up the Python test infrastructure that all subsequent Python tests depend on. Every Python issue in M2–M6 builds on this foundation.

Acceptance Criteria

  • pyproject.toml gains [tool.pytest.ini_options] and [tool.coverage.run] sections with --cov-fail-under=80
  • python/tests/conftest.py created with a mock_gitxtend fixture (MagicMock for all ~25 public functions in gitxtend._gitxtend)
  • Test dependencies declared in pyproject.toml optional group dev: pytest, pytest-cov, pytest-mock
  • CI python-e2e job updated: replace raw python python/tests/test_e2e.py with pytest python/tests/ --cov=gitxtend --cov-fail-under=80
  • .githooks/pre-push updated to match CI (hook parity rule)
  • pytest python/tests/ passes locally after maturin develop

Files

  • pyproject.toml — add pytest + coverage config
  • python/tests/conftest.py — new: mock_gitxtend fixture
  • .github/workflows/ci.yml — update python-e2e job
  • .githooks/pre-push — parity update

Notes

The mock_gitxtend fixture patches gitxtend._gitxtend so unit tests never call the compiled extension. The existing test_e2e.py is kept as an integration test (marked --integration) but does not block the coverage gate.

Beaver (MacBook agent, Claude Sonnet 4.6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    milestone:M2Write Side (v0.2.0)pythonPython implementationtestingTests and coverage

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions