updated django.coverage so it forces the user to specify which application it is using, also added docstrings to django.contrib

This commit is contained in:
ronny abraham 2023-07-07 09:11:44 +03:00
parent 6e807d07a2
commit 868ca7984e

View file

@ -149,16 +149,51 @@ def coverage_test():
@task
def coverage(args="test", workingdir=None, outputdir=None,
def coverage(application, args="test", workingdir=None, outputdir=None,
coveragerc=True, report=True, html=True):
"""
helper method that uses the coverage package
Helper method that uses the coverage package
coveragerc file is located in share/coverage/setup.cfg
you can modify this in the virtualenv settings for this branch
: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.
:type application: string
:parameter args: the manage command that coverage is going to run.
defaults to test
:type args: string
:parameter workingdir: the working directory that manage will run it's
command under. defaults to None
:type workingdir: string
:parameter outputdir: the directory to which file results will be
output to. defaults to None
:type outputdir: string
:parameter coveragerc: flags whether or not there is a coverage settings
file which determines what coverage will or wont do. coveragerc file is
located in share/coverage/setup.cfg you can modify this in the virtualenv
settings for this branch. defaults to True
:type coveragerc: boolean
:parameter report: flags whether or not coverage will be asked to generate
a report. defaults to true.
:type report: boolean
:parameter html: flags whether or not coverage will generate an html
version of its report. defaults to true
:type html: boolean
TODO: test if coverage is installed and if it isn't give
an error explaining the problem
TODO:
currently, django.manage:test is not working properly because it does
not find the tests on all installed applications. Instead, each
application must be tested seperately. For this reason, I require this
method to specifically ask for the applications being used
"""
configuration = env.config
@ -188,6 +223,8 @@ def coverage(args="test", workingdir=None, outputdir=None,
print("\nprefix: %s" % prefix)
print("suffix: %s" % suffix)
args = args + " %s" % application
manage(args=args, workingdir=workingdir, prefix=prefix, suffix=suffix)