#NEWLINE# @ manager . command #NEWLINE# def test( coverage = False ) : #NEWLINE# #INDENT# 'Run the unit tests.' #NEWLINE# if ( coverage and ( not os . environ . get ( 'FLASK_COVERAGE' ) ) ) : #NEWLINE# #INDENT# import sys #NEWLINE# os . environ [ 'FLASK_COVERAGE' ] = '1' #NEWLINE# os . execvp ( sys . executable , ( [ sys . executable ] + sys . argv ) ) #NEWLINE# #UNINDENT# import unittest #NEWLINE# tests = unittest . TestLoader ( ) . discover ( 'tests' ) #NEWLINE# unittest . TextTestRunner ( verbosity = 2 ) . run ( tests ) #NEWLINE# if COV : #NEWLINE# #INDENT# COV . stop ( ) #NEWLINE# COV . save ( ) #NEWLINE# print ( 'Coverage Summary:' ) #NEWLINE# COV . report ( ) #NEWLINE# basedir = os . path . abspath ( os . path . dirname ( __file__ ) ) #NEWLINE# covdir = os . path . join ( covdir , 'tmp/coverage' ) #NEWLINE# COV . html_report ( directory = covdir ) #NEWLINE# print ( ( 'HTML version: file://%s/index.html' % covdir ) ) #NEWLINE# COV . erase ( )