-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
44 lines (33 loc) · 977 Bytes
/
conftest.py
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
import pytest
from fixture.application import Application
fixture = None
@pytest.fixture
def app(request):
global fixture
if fixture is None:
print('create new fixture')
fixture = Application()
fixture.wd_helper.open_home_page()
fixture.session_helper.login_as_admin()
else:
if not fixture.is_valid():
print('rebuild broken fixture')
fixture = Application()
fixture.wd_helper.open_home_page()
fixture.session_helper.login_as_admin()
return fixture
@pytest.fixture
def group(request):
global fixture
fixture.group_helper.open_group_page()
@pytest.fixture
def contact(request):
global fixture
fixture.wd_helper.open_home_page()
@pytest.fixture(scope = 'session', autouse = True)
def finish(request):
def fin():
fixture.session_helper.logout()
fixture.destroy()
print('Finish test session')
request.addfinalizer(fin)