A little background:
- In fixture, I am configuring a browser and closing it in teardown part.
- The scope of the fixture can be dynamic due to the integration with Saucelabs.
- The reason behind is the timeout of a browser configured in SauceLabs.
- That means if I have too many test cases, I have to provide scope="function", otherwise "class" would work.
I want to configure the scope of the fixture dynamically, how can I achieve it.?
Is it possible to configure a pytest args like "--scope={scope}" and provide it to fixture.?
Pseudo code snippet:
@pytest.fixture(scope="function")
def test_helper(request):
# Configure browser
browser = # Saucelab browser
yield browser
browser.quit()