Switch to setuptools
parent
b695dfdcc5
commit
0fa8343098
85
manage.py
85
manage.py
|
@ -1,85 +0,0 @@
|
||||||
# manage.py
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import unittest
|
|
||||||
import coverage
|
|
||||||
|
|
||||||
from flask_script import Manager
|
|
||||||
from flask_migrate import Migrate, MigrateCommand
|
|
||||||
|
|
||||||
COV = coverage.coverage(
|
|
||||||
branch=True,
|
|
||||||
include='project/*',
|
|
||||||
omit=[
|
|
||||||
'project/tests/*',
|
|
||||||
'project/server/config.py',
|
|
||||||
'project/server/*/__init__.py'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
COV.start()
|
|
||||||
|
|
||||||
from project.server import app, db
|
|
||||||
from project.server.models import User
|
|
||||||
|
|
||||||
|
|
||||||
migrate = Migrate(app, db)
|
|
||||||
manager = Manager(app)
|
|
||||||
|
|
||||||
# migrations
|
|
||||||
manager.add_command('db', MigrateCommand)
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def test():
|
|
||||||
"""Runs the unit tests without test coverage."""
|
|
||||||
tests = unittest.TestLoader().discover('project/tests', pattern='test*.py')
|
|
||||||
result = unittest.TextTestRunner(verbosity=2).run(tests)
|
|
||||||
if result.wasSuccessful():
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def cov():
|
|
||||||
"""Runs the unit tests with coverage."""
|
|
||||||
tests = unittest.TestLoader().discover('project/tests')
|
|
||||||
result = unittest.TextTestRunner(verbosity=2).run(tests)
|
|
||||||
if result.wasSuccessful():
|
|
||||||
COV.stop()
|
|
||||||
COV.save()
|
|
||||||
print('Coverage Summary:')
|
|
||||||
COV.report()
|
|
||||||
COV.html_report()
|
|
||||||
COV.erase()
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def create_db():
|
|
||||||
"""Creates the db tables."""
|
|
||||||
db.create_all()
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def drop_db():
|
|
||||||
"""Drops the db tables."""
|
|
||||||
db.drop_all()
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def create_admin():
|
|
||||||
"""Creates the admin user."""
|
|
||||||
db.session.add(User(email='ad@min.com', password='admin', admin=True))
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def create_data():
|
|
||||||
"""Creates sample data."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
manager.run()
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(name='Kappa 123',
|
||||||
|
version='0.0.1',
|
||||||
|
description='Fast ',
|
||||||
|
author='Iliana Weller, Ryan Rix',
|
||||||
|
author_email='ilianaw@buttslol.net, ryan@whatthefuck.computer',
|
||||||
|
#url='',
|
||||||
|
packages=['kappa123'],
|
||||||
|
entry_points='''
|
||||||
|
[console_scripts]
|
||||||
|
kappa_serve=kappa123:bootup
|
||||||
|
''',
|
||||||
|
)
|
Loading…
Reference in New Issue