I would want the user to be able to pass multiple values to one command line argument. For example, if the contents of my contest.py has:
parser.addoption("--url", action="store")
Then I want the user to be able to do this:
python -m pytest test_file.py --url "www.example1.com" "www.example2.com"
This question is basically how to accept multiple arguments for one option.
def pytest_addoption(parser): parser.addoption("--url", type=str, action="append") parser = addoption(parser)
` and then I use it as this: '''def pytest_configure(config): config = configure(config) if config.getoption("url"): urls = config.getoption("url") ''' – Rajat Bhardwaj Jan 14 '19 at 10:27