Created
October 3, 2012 13:57
-
-
Save jeanphix/3827051 to your computer and use it in GitHub Desktop.
Flask-Script test command
This file contains 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
import unittest | |
@manager.command | |
@manager.option('-p', '--path', help='Path to specific test(s).') | |
def test(path=None, verbosity=1): | |
"""Runs tests. | |
""" | |
loader = unittest.TestLoader() | |
if path is None: | |
suite = loader.discover('.', pattern='*.py') | |
else: | |
suite = loader.loadTestsFromName(path) | |
unittest.TextTestRunner(verbosity=int(verbosity)).run(suite) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment