@@ -32,15 +32,16 @@ class Helpers {
32
32
if (project. file(testFilesDirectory). exists()) {
33
33
34
34
project. projectDir. toPath(). resolve(testFilesDirectory). traverse(type : FileType . FILES , nameFilter : ~/ (^test_.*|.*_test)\. py$/ ) { file ->
35
- project. task(" _${ taskName} Coverage" , type : PythonTask , dependsOn : taskDependencies ) {
35
+ project. task(" _${ taskName} Coverage" , type : PythonTask ) {
36
36
module = " coverage"
37
- command = " run --rcfile=${ project.rootProject.file('tools/python/.coveragerc').absolutePath} -m pytest -s ${ testFilesDirectory} "
37
+ command = " run --data-file= ${ testFilesDirectory } /.coverage. ${ taskName } -- rcfile=${ project.rootProject.file('tools/python/.coveragerc').absolutePath} -m pytest -s ${ testFilesDirectory} "
38
38
}
39
- project . task(taskName, type : PythonTask , dependsOn : taskDependencies) {
40
- module = " coverage "
41
- // command = "run --rcfile=${project.rootProject.file('tools/python/.coveragerc').absolutePath} -m pytest -s ${testFilesDirectory} "
42
- command = " report --rcfile=${ project.rootProject.file('tools/python/.coveragerc').absolutePath} "
39
+ // generation of coverage report is optional and we should skip it if tests are empty
40
+ project . task(taskName, type : Exec , dependsOn : taskDependencies) {
41
+ commandLine = " .venv/bin/python "
42
+ args " -m " , " coverage " , " report" , " --data-file= ${ testFilesDirectory } /.coverage. ${ taskName } " , " --rcfile=${ project.rootProject.file('tools/python/.coveragerc').absolutePath} "
43
43
dependsOn project. tasks. findByName(" _${ taskName} Coverage" )
44
+ setIgnoreExitValue true
44
45
45
46
}
46
47
// If a file is found, terminate the traversal, thus causing this task to be declared at most once
@@ -76,9 +77,10 @@ class AirbytePythonPlugin implements Plugin<Project> {
76
77
pip ' isort:5.6.4'
77
78
pip ' pytest:6.1.2'
78
79
pip ' pip:21.1.3'
79
- pip ' coverage[toml]:6.2 '
80
+ pip ' coverage[toml]:6.3.1 '
80
81
}
81
82
83
+
82
84
project. task(' isortFormat' , type : PythonTask ) {
83
85
module = " isort"
84
86
command = " . --settings-file ${ project.rootProject.file('tools/python/.isort.cfg').absolutePath} "
0 commit comments