Skip to content

Instantly share code, notes, and snippets.

@marknagelberg
Created October 14, 2018 00:21
Show Gist options
  • Save marknagelberg/8a765bd0654100a0f205acb275851434 to your computer and use it in GitHub Desktop.
Save marknagelberg/8a765bd0654100a0f205acb275851434 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