You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
980 B
Python

"""App entry point"""
import logging.config
import yaml
import coverage
import pytest
from flask.cli import AppGroup
COV = coverage.coverage(
branch=True,
include='app/*',
omit=['tests/*']
)
COV.start()
from app import create_app, db
# with open('logging.yml', 'r') as f:
# logging.config.dictConfig(yaml.load(f))
app = create_app()
database = AppGroup('database')
database.help = 'Development database commands'
@database.command()
def drop_db():
db.drop_all()
db.session.commit()
@database.command()
def recreate_db():
db.drop_all()
db.create_all()
db.session.commit()
@database.command()
def seed_db():
seed()
app.cli.add_command(database)
@app.cli.command()
def test():
exit(pytest.main(['-x', 'tests']))
@app.cli.command()
def test_coverage():
if pytest.main(['-x', 'tests']):
exit(1)
COV.stop()
COV.save()
print('Coverage Summary:')
COV.report()
COV.html_report()
COV.erase()