Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. @pytest.yield_fixture
  2. def application():
  3. _app = create_app(configName='testing')
  4. _app_ctx = _app.app_context()
  5. _app_ctx.push()
  6. db.create_all()
  7. yield _app
  8. db.session.remove()
  9. db.drop_all()
  10. _app_ctx.pop()
  11.  
  12. @pytest.fixture
  13. def application():
  14. _app = create_app(configName='testing')
  15. _app_ctx = _app.app_context()
  16. _app_ctx.push()
  17. db.create_all()
  18. def _finalize()
  19. db.session.remove()
  20. db.drop_all()
  21. _app_ctx.pop()
  22. request.addfinalizer(_finalize)
  23. return _app
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement