-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Description
Given the following file, the line numbers are not reported correctly:
import pytest
@pytest.fixture(scope="session")
def fix1(request, fix2):
pass
@pytest.fixture
def fix2(fix1):
pass
def test_1(fix1):
pass
platform linux -- Python 3.7.2, pytest-4.3.1.dev29+ga0207274, py-1.7.0, pluggy-0.9.0
…
collected 1 item
t_fail_lnum.py E [100%]
=================================================================================== ERRORS ===================================================================================
__________________________________________________________________________ ERROR at setup of test_1 __________________________________________________________________________
ScopeMismatch: You tried to access the 'function' scoped fixture 'fix2' with a 'session' scoped request object, involved factories
t_fail_lnum.py:3: def fix1(request, fix2)
t_fail_lnum.py:8: def fix2(fix1)
========================================================================== short test summary info ===========================================================================
ERROR t_fail_lnum.py::test_1
========================================================================== 1 error in 0.07 seconds ===========================================================================
The following fixes it:
import pytest
@pytest.fixture(scope="session")
def fix1(request, fix2):
pass
@pytest.fixture
def fix2(fix1):
pass
def test_1(fix1):
pass
Will create a PR later.
Metadata
Metadata
Assignees
Labels
No labels