set expect timeout in its own fixture with autouse to guarantee it will be set before use
This commit is contained in:
parent
755eb6268a
commit
10f5713d8d
1 changed files with 6 additions and 1 deletions
|
|
@ -23,6 +23,12 @@ def pytest_addoption(parser: Parser):
|
||||||
parser.addoption("--timeout", action="store", type=int, default=20_000)
|
parser.addoption("--timeout", action="store", type=int, default=20_000)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def set_expect_timeout(request):
|
||||||
|
TIMEOUT = request.config.getoption("--timeout")
|
||||||
|
expect.set_options(timeout=TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def context(context: BrowserContext, request) -> BrowserContext:
|
def context(context: BrowserContext, request) -> BrowserContext:
|
||||||
# note: because this has the existing context fixture as an argument, it is ensured
|
# note: because this has the existing context fixture as an argument, it is ensured
|
||||||
|
|
@ -33,7 +39,6 @@ def context(context: BrowserContext, request) -> BrowserContext:
|
||||||
|
|
||||||
context.set_default_timeout(TIMEOUT)
|
context.set_default_timeout(TIMEOUT)
|
||||||
context.set_extra_http_headers(LOCALE)
|
context.set_extra_http_headers(LOCALE)
|
||||||
expect.set_options(timeout=TIMEOUT)
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue