Test Overview
This test checks that a fixture defined in conftest.py is properly shared and used in a test file. It verifies that the fixture runs and provides the expected value to the test.
This test checks that a fixture defined in conftest.py is properly shared and used in a test file. It verifies that the fixture runs and provides the expected value to the test.
import pytest # conftest.py @pytest.fixture def sample_fixture(): return "hello from fixture" # test_sample.py def test_using_fixture(sample_fixture): assert sample_fixture == "hello from fixture"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | pytest starts test discovery and finds test_using_fixture in test_sample.py | pytest environment ready, conftest.py fixture available | - | PASS |
| 2 | pytest loads conftest.py and registers sample_fixture fixture | fixture sample_fixture is ready to be injected | - | PASS |
| 3 | pytest runs test_using_fixture and injects sample_fixture | test_using_fixture receives 'hello from fixture' as sample_fixture value | assert sample_fixture == 'hello from fixture' | PASS |
| 4 | pytest completes test run and reports results | test_using_fixture passed successfully | - | PASS |