Skip to content

Commit

Permalink
Added a null check for the htmlDir in PyCoverageTask
Browse files Browse the repository at this point in the history
Handling of an edge case: If the user configures the project
to run covergae but there is no coverage output (i.e. no
coverage to report), the htmlDir parsed from the output will
ultimately be null, and thus the call to project.file(htmlDir)
fails with IllegalArgumentException: path may not be null or
empty string. path='null'
  • Loading branch information
elautz committed Dec 3, 2019
1 parent 963cc18 commit cb03227
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ class PyCoverageTask extends PyTestTask {
String htmlDir = streamProcessor.htmlDir
String coverage = streamProcessor.coverage


FileUtils.copyDirectoryToDirectory(project.file(htmlDir), coverageOutputDir)
// If there is no coverage to report, then the htmlDir value will be empty
if (htmlDir != null) {
FileUtils.copyDirectoryToDirectory(project.file(htmlDir), coverageOutputDir)
}

CoverageXmlReporter coverageXmlReport = new CoverageXmlReporter(coverage)
coverageReport.text = coverageXmlReport.generateXML()
Expand Down

0 comments on commit cb03227

Please sign in to comment.