Last active
September 15, 2021 12:43
-
-
Save samkit-jain/4035bd3a172c9b1b5b8278b52484cb77 to your computer and use it in GitHub Desktop.
Juvoxa Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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