add timeout parameter to pytest-abra
This commit is contained in:
parent
9986e46019
commit
a499891fe8
1 changed files with 15 additions and 15 deletions
|
|
@ -15,26 +15,26 @@ from pytest_abra.dir_manager import DirManager
|
|||
from pytest_abra.env_manager import EnvFile
|
||||
from pytest_abra.utils import BaseUrl
|
||||
|
||||
# global timeout and LOCALE
|
||||
LOCALE = {"Accept-Language": "de_DE"}
|
||||
TIMEOUT = 20_000
|
||||
expect.set_options(timeout=TIMEOUT)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def context(context: BrowserContext) -> BrowserContext:
|
||||
# note: because this has the existing context fixture as an argument, it is ensured
|
||||
# that the original fixture is called first and then overwritten by this custom one.
|
||||
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
context.set_extra_http_headers(LOCALE)
|
||||
return context
|
||||
|
||||
|
||||
def pytest_addoption(parser: Parser):
|
||||
parser.addoption("--runner_index", action="store", type=int)
|
||||
parser.addoption("--output_dir", action="store", type=Path)
|
||||
parser.addoption("--session_id", action="store", type=str)
|
||||
parser.addoption("--timeout", action="store", type=int, default=20_000)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def context(context: BrowserContext, request) -> BrowserContext:
|
||||
# note: because this has the existing context fixture as an argument, it is ensured
|
||||
# that the original fixture is called first and then overwritten by this custom one.
|
||||
|
||||
TIMEOUT = request.config.getoption("--timeout")
|
||||
LOCALE = {"Accept-Language": "de_DE"}
|
||||
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
context.set_extra_http_headers(LOCALE)
|
||||
expect.set_options(timeout=TIMEOUT)
|
||||
return context
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue