I include at conftetst.py my own command line options
def pytest_addoption(parser):
parser.addoption("--backend" , default="test_backend",
help="run testx for the given backend, default: test_backend")
and
def pytest_generate_tests(metafunc):
if 'backend' in metafunc.funcargnames:
if metafunc.config.option.backend:
backend = metafunc.config.option.backend
backend = backend.split(',')
backend = map(lambda x: string.lower(x), backend)
metafunc.parametrize("backend", backend)
If I use this command line option inside a normal function inside a module:
module: test_this.py;
def test_me(backend):
print backend
it works as expected.
Now I want to include the setup_module function to create /copy some stuff before some tests:
def setup_module(backend):
import shutil
shutil.copy(backend, 'use_here')
...
unfortunately I have now idea how to get access to this command line option inside the setup_module function. Nothing works, what I tried.
Thanks for help, suggestions.
Cheers