pytest-dev / pytest-dev/pytest

Pytest 8.4 fails to discover a test fixture withtin a test class when combined with the usage of freezegun

Open
#13,479 20 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: regression
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Environment:
pytest 8.4.1
freezegun 1.5.2

Description:
Pytest 8.4 fails to discover a test fixture withtin a test class when combined with the usage of freezegun.
The below minimal example runs with pytest 8.3.x

Minimal example:

import pytest
from freezegun import freeze_time

@freeze_time()
class TestA:
    @pytest.fixture
    def ff(self):
        return 1

    def test_a(self, ff):
        assert ff == 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal example with pytest 8.4.1 and 8.3.x alongside freezegun 1.5.2, then trace pytest's fixture discovery for methods inside decorated test classes. Done means the ff fixture is discovered and test_a passes under pytest 8.4 without breaking the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.