Skip to content

Instantly share code, notes, and snippets.

@damianrr
Created May 16, 2018 14:10
Show Gist options
  • Save damianrr/252fbf04130a660ad8d455b282390de0 to your computer and use it in GitHub Desktop.
Save damianrr/252fbf04130a660ad8d455b282390de0 to your computer and use it in GitHub Desktop.
TEST_DB_URI = 'mysql+pymysql://amerit:amerit@mysqldb/test_amerit'
--from ftcore.models import Group, GroupAssociation, User, UserRole
@pytest.fixture(scope="session")
def app(request):
app = create_app(SERVER_NAME='fym.test:3000',
SQLALCHEMY_DATABASE_URI=TEST_DB_URI)
app.testing = True
context = app.app_context()
context.push()
yield app
context.pop()
@pytest.fixture
def session(app):
engine = create_engine(TEST_DB_URI)
session = sessionmaker(bind=engine)
_session = session()
with app.app_context():
_db.create_all()
yield _session
_session.close()
_db.drop_all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment