Skip to content

tests: Migrate from unmaintained pytest-lazy-fixture to pytest-lazy-fixtures #7759

@matthewelwell

Description

@matthewelwell

Background

api/pyproject.toml currently depends on pytest-lazy-fixture==0.6.3, which has been unmaintained since 2020. It accesses pytest's internal CallSpec2.funcargs attribute, which was removed in pytest 9, so the package is incompatible with pytest 8 and above:

ERROR tests/unit/permissions/permission_service/test_get_permitted_projects_for_user.py - AttributeError: 'CallSpec2' object has no attribute 'funcargs'

This was surfaced while investigating #7756 (removing the [tool.uv].override-dependencies block). For now, pytest is capped at <8 in the dev extra to keep the existing tests green.

Proposed work

Migrate the ~297 lazy_fixture(...) call sites in api/tests/ to the maintained fork pytest-lazy-fixtures (note the plural), which uses a different API:

  • lazy_fixture("name")lf("name")
  • New: lfc("name", arg) for fixture composition

Once migrated, the pytest cap can be lifted and we'll be able to take pytest 8/9 updates.

Acceptance criteria

  • Replace pytest-lazy-fixture with pytest-lazy-fixtures in api/pyproject.toml
  • Update all call sites under api/tests/ to the new API
  • Lift the pytest<8 cap in api/pyproject.toml
  • Remove the TODO markers added in chore(api): Remove uv override-dependencies block #7756 referencing this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssue related to the REST API

    Type

    No type
    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