From 868ca7984e626b3555e74d59f7d2be063447204a Mon Sep 17 00:00:00 2001 From: ronny abraham Date: Fri, 7 Jul 2023 09:11:44 +0300 Subject: [PATCH] updated django.coverage so it forces the user to specify which application it is using, also added docstrings to django.contrib --- modules/django.py | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/modules/django.py b/modules/django.py index ef0d8c8..60e6bae 100644 --- a/modules/django.py +++ b/modules/django.py @@ -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)