Guest User

Untitled

a guest
Apr 30th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import pytest
  2. from fixture.application import Application
  3.  
  4.  
  5. @pytest.fixture
  6. def app(request):
  7. global fixture
  8. if fixture is None:
  9. fixture = Application()
  10. fixture.session.login(username="admin", password="secret")
  11. else:
  12. if not fixture.is_valid():
  13. fixture = Application()
  14. fixture.session.login(username="admin", password="secret")
  15. return fixture
  16.  
  17. @pytest.fixture(scope="session", autouse=True)
  18. def stop(request):
  19. def fin():
  20. fixture.session.logout()
  21. fixture.destroy()
  22. request.addfinalizer(fin)
  23. return fixture
Add Comment
Please, Sign In to add comment