Skip to content

Test suite can't run on a fresh clone: pytest-mock is used but never declared #153

Description

@khldLabs

Description

Following the dev setup in CONTRIBUTING.md on a fresh clone leaves the test suite unable to run one of its tests. CONTRIBUTING.md (lines 137-138) says to run pip install -e . and pip install -r requirements.txt, then (line 164) pytest tests/. Neither install declares pytest-mock, but tests/test_compose_scanner.py::test_compose_orchestrator_offline requests the mocker fixture, so it errors out for every new contributor. CI doesn't catch this because .github/workflows/coverage.yml (line 29) and .github/workflows/python-app.yml (line 57) each pip install pytest pytest-mock inline, so the dependency is satisfied there but declared nowhere.

Repro on a clean checkout:

$ python -m venv .venv && . .venv/bin/activate
$ pip install -e .
$ pip install -r requirements.txt
$ pytest tests/
...
ERROR at setup of test_compose_orchestrator_offline
file tests/test_compose_scanner.py, line 132
  def test_compose_orchestrator_offline(valid_compose_file, mocker):
E       fixture 'mocker' not found
...
179 passed, 1 error

pip install pytest-mock fixes it, and the suite goes fully green (180 passed).

Proposed fix

Declare the test dependencies rather than installing them ad hoc in CI: add an extras_require={"dev": ["pytest", "pytest-cov", "pytest-mock"]} to setup.py, point CONTRIBUTING.md at pip install -e ".[dev]", and let the two workflows install the same extra instead of listing packages inline. That keeps the contributor path and the CI path from drifting apart again. Happy to open a PR for this if it sounds right — it's a small change and I'd rather not guess at the exact extra name you'd prefer (dev vs test).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions