Last active
August 29, 2015 14:02
-
-
Save wiesson/b4a97ba79541638809c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/usr/bin/env python | |
import os | |
import argparse | |
from app import create_app | |
from flask.ext.script import Manager | |
parser = argparse.ArgumentParser() | |
parser.add_argument("go", help="runserver, test, shell") | |
args = parser.parse_args() | |
if args.go == 'runserver' or 'shell': | |
os.environ['FLASK_CONFIG'] = 'development' | |
if args.go == 'test': | |
os.environ['FLASK_CONFIG'] = 'testing' | |
app = create_app(os.getenv('FLASK_CONFIG') or 'default') | |
manager = Manager(app) | |
@manager.command | |
def test(): | |
"""Run the unit tests.""" | |
import unittest | |
tests = unittest.TestLoader().discover('tests') | |
unittest.TextTestRunner(verbosity=2).run(tests) | |
if __name__ == '__main__': | |
manager.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment