My recommendation will add the device to conftest.pyand will definitely return the object that you want to create from the lamp.
As already noted, this makes "autouse" seemingly worthless.
conftest.py:
@pytest.fixture(scope='session', autouse=True)
def someobj(request):
return SomeObj()
(, test_foo.py):
def test_foo(someobj):
assert isinstance(someobj, SomeObj)
, .
, conftest.py:
someobj = None
@pytest.fixture(scope='session', autouse=True)
def prep_someobj(request):
someobj = SomeObj()
:
from . import conftest
def test_foo():
assert isinstance(conftest.someobj, SomeObj)
-, , .