Skip to content
Advertisement

Provide default argument value for py.test fixture function

Is there a better way for me to provide default value for argument pytest.fixture function?

I have a couple of testcases that requires to run fixture_func before testcase and I would like to use default value for argument in fixture if none of them is provided. The only code I can come up with is as follows. Any better way for me to do it?

JavaScript

i wna to use as

JavaScript

Advertisement

Answer

None is the default result

JavaScript

So, you can just:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement