-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconftest.py
More file actions
49 lines (35 loc) · 1.11 KB
/
conftest.py
File metadata and controls
49 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pytest
from src.main.allure_helpers import AllureCatchLogs
pytest_plugins = ['fixtures_browsers', 'fixtures_session']
def pytest_addoption(parser):
"""Pytest option variables"""
parser.addoption(
'--browser',
help=u'Which test browser?',
choices=['chrome', 'firefox'],
default='chrome',
)
parser.addoption('--remote', help=u'Is remote webdriver?', default='')
@pytest.fixture(scope='session')
def t_browser(request):
"""Test browser. Params: [chrome, opera, firefox]."""
return request.config.getoption('--browser')
@pytest.fixture(scope='session')
def is_remote(request):
"""if browser is remote? Returns: True/False."""
return bool(request.config.getoption('--remote'))
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_setup():
"""Allure hook"""
with AllureCatchLogs():
yield
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call():
"""Allure hook"""
with AllureCatchLogs():
yield
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_teardown():
"""Allure hook"""
with AllureCatchLogs():
yield