| Adam Israel | 59f3581 | 2017-02-24 10:47:15 +0100 | [diff] [blame^] | 1 | import yaml |
| 2 | |
| 3 | |
| 4 | config = None |
| 5 | with open('config.yaml') as f: |
| 6 | config = yaml.load(f) |
| 7 | |
| 8 | |
| 9 | def pytest_addoption(parser): |
| 10 | for param in config: |
| 11 | parser.addoption("--{}".format(param), |
| 12 | action="store", |
| 13 | type="{}".format(config[param]["type"]), |
| 14 | default="{}".format(config[param]["default"]), |
| 15 | help="{}".format(config[param]["description"]) |
| 16 | ) |
| 17 | |
| 18 | |
| 19 | def pytest_generate_tests(metafunc): |
| 20 | for param in config: |
| 21 | if param in metafunc.fixturenames: |
| 22 | metafunc.parametrize(param, [metafunc.config.getoption(param)]) |