added error checking to django.coverage so that if no value is passed in to application, the program sends a message and exits
This commit is contained in:
parent
e218dc827c
commit
4ae41d9ed7
1 changed files with 20 additions and 1 deletions
|
|
@ -7,10 +7,16 @@ import os
|
|||
import sys
|
||||
import pathlib
|
||||
|
||||
|
||||
ERRCODE_DJANGO_COVERAGE_NO_APPLICATION_PARAMETER_SET = -3
|
||||
|
||||
|
||||
dir_parent = pathlib.Path(os.path.abspath(__file__)).parents[2]
|
||||
sys.path.append(str(dir_parent))
|
||||
|
||||
try:
|
||||
import customfabric.modules.utils as modules_utils
|
||||
|
||||
from customfabric.modules.utils import virtualenv
|
||||
from customfabric.modules.utils import loggify, print_run, booleanize
|
||||
from customfabric.modules.utils import generate_template_build_path
|
||||
|
|
@ -200,7 +206,7 @@ def coverage_test():
|
|||
|
||||
|
||||
@task
|
||||
def coverage(application, args="test", workingdir=None, outputdir=None,
|
||||
def coverage(application=None, args="test", workingdir=None, outputdir=None,
|
||||
coveragerc=True, report=True, html=True):
|
||||
"""
|
||||
Helper method that uses the coverage package
|
||||
|
|
@ -208,6 +214,8 @@ def coverage(application, args="test", workingdir=None, outputdir=None,
|
|||
:parameter application: the name of the installed application being tested.
|
||||
NOTE: this is required because currently I do not know how to run
|
||||
manage.py test on all installed applications.
|
||||
|
||||
If no value is given, the program will give a message and exit.
|
||||
:type application: str
|
||||
|
||||
:parameter args: the manage command that coverage is going to run.
|
||||
|
|
@ -248,6 +256,17 @@ def coverage(application, args="test", workingdir=None, outputdir=None,
|
|||
method to specifically ask for the applications being used
|
||||
"""
|
||||
|
||||
#
|
||||
# make sure that the application parameter was set
|
||||
|
||||
if application is None:
|
||||
modules_utils.printerr(
|
||||
message="\nThe application parameter for django.coverage"
|
||||
" was not set! Please make sure you have set application"
|
||||
" to the application you wish to have coverage applied to!"
|
||||
"\nExiting.",
|
||||
errcode=ERRCODE_DJANGO_COVERAGE_NO_APPLICATION_PARAMETER_SET)
|
||||
|
||||
configuration = env.config
|
||||
|
||||
coverage_test()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue