From b92c025f7566d147949421296ee6471b010bc5ea Mon Sep 17 00:00:00 2001 From: ronny abraham Date: Mon, 3 Jul 2023 23:19:11 +0300 Subject: [PATCH] updated coverage to look for the coverage.rc file as setup.cfg in share/coverage and the print out htmlcov in share/coverage --- modules/django.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/django.py b/modules/django.py index 46d3aad..a4cac84 100644 --- a/modules/django.py +++ b/modules/django.py @@ -124,10 +124,12 @@ def manage(args="", workingdir=None, prefix=None, suffix=None): @task def coverage(args="help", workingdir=None, outputdir=None, - report=True, html=True): + coveragerc=False, report=True, html=True): """ helper method that uses the coverage package + coveragerc file is only locaterd in share/coverage/setup.cfg + TODO: test if coverage is installed and if it isn't give an error explaining the problem """ @@ -143,13 +145,19 @@ def coverage(args="help", workingdir=None, outputdir=None, if html: suffix += "&& coverage html" + coveragepath = "{projectroot}/share/coverage".format( + projectroot=configuration.paths.project.root, + outputdir=outputdir) + + if coveragerc: + suffix += " --rcfile={coveragepath}/setup.cfg".format( + coveragepath=coveragepath) + if outputdir: outputpath = outputdir else: - outputpath = "{projectroot}/share".format( - projectroot=configuration.paths.project.root, - outputdir=outputdir) + outputpath = coveragepath outputpath += "/htmlcov" suffix += " -d %s" % outputpath