- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.9k
 
Closed
Copy link
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Via pytest-dev/pytest-django#1246.
The statically-computed fixture closure of a test item doesn't properly handle transitive dependencies through overridden fixtures, as demonstrated in the failing test below:
import pytest
@pytest.fixture
def db(): pass
@pytest.fixture
def app(db): pass
class TestClass:
    # Overrides module-level app, doesn't request `db` directly, only transitively.
    @pytest.fixture
    def app(self, app): pass
    def test_something(self, request, app):
        # Dynamic fixture closure calculated during run phase. Works.
        assert 'db' in request.fixturenames
        # Static fixture closure calculated during collection phase. Fails, but should work.
        assert 'db' in request.node.fixturenamesMetadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: bugproblem that needs to be addressedproblem that needs to be addressed