conftest.py 438 B

12345678910111213141516171819202122232425
  1. import pytest
  2. from app import create_app, db
  3. @pytest.fixture
  4. def app():
  5. """Create application for testing"""
  6. app = create_app('testing')
  7. with app.app_context():
  8. db.create_all()
  9. yield app
  10. db.drop_all()
  11. @pytest.fixture
  12. def client(app):
  13. """Create test client"""
  14. return app.test_client()
  15. @pytest.fixture
  16. def runner(app):
  17. """Create test CLI runner"""
  18. return app.test_cli_runner()