Skip to content

Instantly share code, notes, and snippets.

@marknagelberg
Created October 14, 2018 00:21
Show Gist options
  • Save marknagelberg/1ca20b79e6bdf0931d9be3b869735958 to your computer and use it in GitHub Desktop.
Save marknagelberg/1ca20b79e6bdf0931d9be3b869735958 to your computer and use it in GitHub Desktop.
App deploy testing code to create database fixture
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