X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=test%2Fexample%2Fconftest.py;fp=test%2Fexample%2Fconftest.py;h=3798a150c8c12f9732214d32dd33b9b65f5af6ce;hb=59f35810e65c6a06adce23c54dd02bc9332a08c0;hp=0000000000000000000000000000000000000000;hpb=56d59fcea505e5c4cee2bed623a98c4c8ca1ee6a;p=osm%2Fdevops.git diff --git a/test/example/conftest.py b/test/example/conftest.py new file mode 100644 index 00000000..3798a150 --- /dev/null +++ b/test/example/conftest.py @@ -0,0 +1,22 @@ +import yaml + + +config = None +with open('config.yaml') as f: + config = yaml.load(f) + + +def pytest_addoption(parser): + for param in config: + parser.addoption("--{}".format(param), + action="store", + type="{}".format(config[param]["type"]), + default="{}".format(config[param]["default"]), + help="{}".format(config[param]["description"]) + ) + + +def pytest_generate_tests(metafunc): + for param in config: + if param in metafunc.fixturenames: + metafunc.parametrize(param, [metafunc.config.getoption(param)])