I need to pass function as arguments in pytest parametrization. and need to call those functions inside test function. Is there any way to do it without using eval?
I have fixtures defined in conftest.py which returns object to classes(defined in helper.py) I need to call the class methods(in helper.py) from the test function. I am passing the class name.methodname as parameters.
Eg:
@pytest.mar.parametrize('fun', ['class_a.function1()','class_b.function2()'])
def test1(class_a, class_b):
eval(fun)
eval() makes call to classA.function1 and classB.function2 where class_a and Class_b are fixtues that returns object of ClassA and ClassB Respectively.
The above example works fine. But I need to replace eval with something better.
Is there a better way to do this? Any help is appreciated!!!!