I have session binding in conftest.py
@pytest.fixture(scope="session",autouse=True)
def log(request):
testlog = LogUtil(testconf.LOG_NAME).get()
return testlog
This loads and works as expected when the test method is defined in mytest.py as follows:
def test_hello_world(self, log):
log.info("hello world test")
Is there a way to use the device (with its authorization turned on) without the need to add an additional parameter "log" for testing methods?
def test_hello_world(self):
log.info("hello world test")
@pytest.mark.usefixtures("log")
def test_hello_world2(self):
log.info("hello world test")
def test_hello_world3(self,log):
log.info("hello world test")
Error - NameError: name 'log' not defined
source
share