I am trying to pass a value returned by a class method into a test method in the same class.
def SampleTest:
# my dynamic value generation function
def dynamicValue(self):
result = 10
return result
# how to pass a value returned by dynamicValue method?
@pytest.mark.parametrize('value', [1, 2, dynamicValue])
def test_case(self, value):
print(f'Testing for input value {value}')
# testing functionality...
By dynamic value I mean some numeric value fetched from operating system during collect phase of tests execution. How to do this correctly? Above example doesn't work.
Aucun commentaire:
Enregistrer un commentaire