conftest.py 801 Bytes
Newer Older
Pablo Panero's avatar
Pablo Panero committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

def pytest_addoption(parser):
    parser.addoption("--endpoint", action="store",
                     default="https://dev-cern-search.web.cern.ch/")
    parser.addoption("--api_key", action="store",
                     default="XXXXKKKKKZZZZWWWW")


def pytest_generate_tests(metafunc):
    # This is called for every test. Only get/set command line arguments
    # if the argument is specified in the list of test "fixturenames".
    endpoint_value = metafunc.config.option.endpoint
    if 'endpoint' in metafunc.fixturenames and endpoint_value is not None:
        metafunc.parametrize("endpoint", [endpoint_value])
    api_key_value = metafunc.config.option.api_key
    if 'api_key' in metafunc.fixturenames and api_key_value is not None:
        metafunc.parametrize("api_key", [api_key_value])