import pytest
@pytest.fixture
def shared_fixture() -> str:
return "shared_value"
@pytest.fixture
def another_fixture() -> int:
return 42
class TestClassBased:
def test_uses_shared(self, shared_fixture: str):
assert shared_fixture == "shared_value"
def test_uses_both(self, shared_fixture: str, another_fixture: int):
assert shared_fixture == "shared_value"
assert another_fixture == 42
def test_uses_another(self, another_fixture: int):
assert another_fixture == 42
class TestNestedClasses:
def test_outer(self, shared_fixture: str):
assert shared_fixture == "shared_value"
class TestInner:
def test_inner(self, shared_fixture: str):
assert shared_fixture == "shared_value"