Created
October 14, 2018 00:21
-
-
Save marknagelberg/1ca20b79e6bdf0931d9be3b869735958 to your computer and use it in GitHub Desktop.
App deploy testing code to create database fixture
This file contains 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 | |
from app.models import Name | |
from app import db | |
@pytest.yield_fixture(scope='module') | |
def create_database(): | |
db.create_all() | |
name = Name(name='Mark') | |
db.session.add(name) | |
db.session.commit() | |
yield db | |
db.session.close() | |
db.drop_all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment