SHARE
TWEET

Untitled

a guest Oct 21st, 2019 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from fixture.application import Application
  2. import pytest
  3.  
  4.  
  5. fixture = None
  6.  
  7.  
  8. @pytest.fixture()
  9. def app():
  10.     global fixture
  11.     if fixture is None:
  12.         fixture = Application()
  13.     else:
  14.         if not fixture.is_valid():
  15.             fixture = Application()
  16.     fixture.session.ensure_login(username="admin", password="secret")
  17.     return fixture
  18.  
  19.  
  20. @pytest.fixture(scope="session", autouse=True)
  21. def stop(request):
  22.     def fin():
  23.         fixture.session.ensure_logout()
  24.         fixture.destroy()
  25.     yield fixture
  26.     request.addfinalizer(fin)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top