Warning "PytestUnknownMarkWarning: Unknown pytest.mark.usefixgture - @pytest.mark.usefixture("base_fixture") | Selenium Python Forum
M
Mohan Posted on 03/09/2020

I am getting warning messagae "PytestUnknownMarkWarning: Unknown pytest.mark.usefixgture - @pytest.mark.usefixture("base_fixture") while running the test case. It is not returning any data in console. I think it would be great if you could arrange one person to review my code if I am making any mistake or misssing anything.

Please seee attached screen shot

 


M
Mohan Replied on 03/09/2020

 Please see below code from conftest module as reference for my above issue.

 

from pyjavaproperties import Properties
import pytest

#Create an object for properties class and variables for both Production and Environment properties.
prod=Properties()
envProp=Properties()

#Create a method to access property files

@pytest.fixture()
def base_fixture():

#To open and load environment properties file

#Environment file path
prodPath=open("E:\\PythonHybridFramework\\KMHybridFramework\\environment.properties")
#Load environment properties
prod.load(prodPath)
prod.list()

print("-----------------------------------------------------------")
#production properties file path
path=open("E:\\PythonHybridFramework\\KMHybridFramework\\"+prod['env']+".properties")
#Load production properties file
envProp.load(path)
envProp.list()


J
Jaspreet Replied on 04/09/2020

Hey, 

This annotation is not rightly given "@pytest.mark.usefixture("base_fixture") over the test case. It is @pytest.mark.usefixtures. Correct that on the test case and your code is running without any error or warnings.


J
Jaspreet Replied on 04/09/2020

Hey, 

This annotation is not rightly given "@pytest.mark.usefixture("base_fixture") over the test case. It is @pytest.mark.usefixtures. Correct that on the test case and your code is running without any error or warnings.