I have to to pass an argument in my pytest command which I am storing in pytest addoption. I want to use these values in the pytest parametrize function.
Command:
pytest --range-from 3 --range-to 5 test.py
conftest.py:
def pytest_addoption(parser):
parser.addoption("--range-from", action="store", default="default name")
parser.addoption("--range-to", action="store", default="default name")
test.py:
@pytest.mark.parametrize('migration_id', migration_list[range-from:range-to])
def test_sync_with_migration_list(migration_id):
migration_instance = migration.parallel(migration_id=migration_id)
migration_instance.perform_sync_only()
I want to use the value of range-from and range-to inside parametrize.
I am not able to use these values. Please suggest how can this can be done.