# pytest fixture not found

Classification: dependency
Frameworks: pytest
Canonical: https://automationtester.in/failures/pytest-fixture-not-found

## Recognizable error

```text
fixture 'name' not found
```

## What it means

pytest could not find a fixture with the requested name in the test's visible fixture scope.

## Ranked causes, checks, and fixes

### 1. The fixture module is outside discovery scope

Fixtures are visible through conftest.py hierarchy or registered plugins, not arbitrary imports by convention.

Diagnostic: Run `pytest --fixtures` for the failing path and confirm the fixture is listed.

Fix: Move the fixture to the correct conftest.py or register its plugin explicitly.

### 2. The fixture was renamed or misspelled

The test parameter no longer matches the fixture function name.

Diagnostic: Compare the requested name with the available-fixtures section in the error.

Fix: Update the parameter or provide a compatibility fixture during migration.

### 3. The plugin providing the fixture is not installed

Local and CI dependency sets may differ.

Diagnostic: Compare locked dependencies and plugin registration in both environments.

Fix: Add the plugin to the test dependency group and lock it.

## Prevention

- Keep fixture scope close to consumers.
- Run collection in CI.
- Lock test plugins.

## Primary references

- [pytest fixtures](https://docs.pytest.org/en/stable/how-to/fixtures.html)

Triage this failure locally: https://automationtester.in/tools/test-failure-triage