[TIP] User defined pytest parameter in setup

Fabian Cenedese Cenedese at indel.ch
Fri Mar 22 08:14:28 PDT 2019


At 15:46 22.03.2019, Brian Okken wrote:

>Fabian,
>
>`setup_module(module)` is a supported nose function.
>
>I know that I'm not giving you the answer that you want, which is essentially to be able to grab config from your `setup_module(module)` as is.
>
>However, you are already using pytest. Why are you holding onto `setup_module(module)`?
>
>If you change the signature of that function to be a proper pytest fixture, it will then be easy.
>
>``
>@pytest.fixture(scope='module', autouse=True)
>def setup_module(name):
>  ½   print(f"\nsetup_module() name: {name}")`

Thanks for your help. As you may have guessed I'm a newbie to pytest.
I never used nose, I just gathered my code with the help of examples
from the internet, e.g.
http://pythontesting.net/framework/pytest/pytest-introduction/

I now changed my setup function accordingly and could get it to work.

Thanks again

bye  Fabi




More information about the testing-in-python mailing list