Skip to content

Instantly share code, notes, and snippets.

@samkit-jain
Last active September 15, 2021 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samkit-jain/4035bd3a172c9b1b5b8278b52484cb77 to your computer and use it in GitHub Desktop.
Save samkit-jain/4035bd3a172c9b1b5b8278b52484cb77 to your computer and use it in GitHub Desktop.
Juvoxa Testing
import pytest
def pytest_sessionstart(session):
"""This is run before the tests are run.
So, if you want to make any changes like creating a dummy ``.env`` file,
you can do so here.
"""
pass
@pytest.fixture(scope="session")
def app():
from myflaskapi.app import initialize_app, db
app = initialize_app()
with app.app_context():
# Drop the data in the database and create it again with all the required models.
db.drop_all()
db.create_all()
initialize_app()
yield app
@pytest.fixture
def client(app):
return app.test_client()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment