def runCoverage(crcpath): if not exists(crcpath): createCoveragerc(crcpath) elif not checkCoveragerc(crcpath): raise SystemExit("This folder contains a .coveragerc-file not created by Devilry.") managepath = join(getcwd(), "manage.py") commands = ["coverage", "run", managepath, "test"] if len(sys.argv) > 1: commands.append(sys.argv[1]) call(append_pythonexec_to_command(commands))
def runCoverage(crcpath): if not exists(crcpath): createCoveragerc(crcpath) elif not checkCoveragerc(crcpath): raise SystemExit( 'This folder contains a .coveragerc-file not created by Devilry.') managepath = join(getcwd(), 'manage.py') commands = ["coverage", "run", managepath, "test"] if len(sys.argv) > 1: commands.append(sys.argv[1]) call(append_pythonexec_to_command(commands))
def checkCoveragerc(crcpath): coveragercfile = open(crcpath, 'r') line = coveragercfile.readline() coveragercfile.close() if line == '#automatically created by devilry\n': return True return False def runCoverage(crcpath): if not exists(crcpath): createCoveragerc(crcpath) elif not checkCoveragerc(crcpath): raise SystemExit( 'This folder contains a .coveragerc-file not created by Devilry.') managepath = join(getcwd(), 'manage.py') commands = ["coverage", "run", managepath, "test"] if len(sys.argv) > 1: commands.append(sys.argv[1]) call(append_pythonexec_to_command(commands)) require_djangoproject() crcpath = join(getcwd(), '.coveragerc') runCoverage(crcpath) if exists(crcpath): remove(crcpath)
def checkCoveragerc(crcpath): coveragercfile = open(crcpath, "r") line = coveragercfile.readline() coveragercfile.close() if line == "#automatically created by devilry\n": return True return False def runCoverage(crcpath): if not exists(crcpath): createCoveragerc(crcpath) elif not checkCoveragerc(crcpath): raise SystemExit("This folder contains a .coveragerc-file not created by Devilry.") managepath = join(getcwd(), "manage.py") commands = ["coverage", "run", managepath, "test"] if len(sys.argv) > 1: commands.append(sys.argv[1]) call(append_pythonexec_to_command(commands)) require_djangoproject() crcpath = join(getcwd(), ".coveragerc") runCoverage(crcpath) if exists(crcpath): remove(crcpath)
#!/usr/bin/env python # Check test coverage and create a html-report of the results from common import depends, Command, require_djangoproject, getcwd, append_pythonexec_to_command from subprocess import call from os.path import join from sys import argv htmlout = join(getcwd(), 'coverage_html_report') require_djangoproject() depends(Command('coverage', *argv[1:])) command = ["coverage", "html", "-i", "-d", htmlout] call(append_pythonexec_to_command(command))