1

Pygradle is used to build and test a Python project. In gradle it is possible to define a minimum code coverage percentage:

jacocoTestCoverageVerification {
    violationRules {
        rule {
            limit {
                minimum = 0.5
            }
        }

        rule {
            enabled = false
            element = 'CLASS'
            includes = ['org.gradle.*']

            limit {
                counter = 'LINE'
                value = 'TOTALCOUNT'
                maximum = 0.3
            }
        }
    }
}

If this limit is not reached, build will fail. Is it possible to define a minimum code coverage using Pygradle?

When the above snippet is run, the build fails and the following is returned:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/user/SomeProject/build.gradle' line: 14

* What went wrong:
A problem occurred evaluating root project 'SomeProject'.
> Could not find method jacocoTestCoverageVerification() for arguments [build_fsdafasdfsa] on root project 'SomeProject' of type org.gradle.api.Project.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
2
0

At the moment it looks like it is not possible to define a minimum code coverage as the ticket that was created is still open https://github.com/linkedin/pygradle/issues/184

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.