linkedin / pygradle

Using Gradle to build Python projects
https://github.com/linkedin/pygradle
Apache License 2.0
588 stars 147 forks source link

Modified ValidationPlugin to ensure pytests only run once #319

Closed elautz closed 5 years ago

elautz commented 5 years ago

Currently, if coverage is enabled for a build, the pytest task is run and then the coverage task is run, which inherits from the pytest task, and consequently, the pytest suite is run twice. Added logic to ensure the either pytest XOR coverage task is part of the build. Also added logic to existing integration tests (PythonPluginIntegrationTest, PexIntegrationTest) to verify that the coverage/pytest tasks are skipped when expected

warsaw commented 5 years ago

I'm curious what happens for libraries, where we might run pytest over all supported versions, but coverage only over the default version?

elautz commented 5 years ago

@lorencarvalho CI failed because of an existing bug in Pygradle. Just pushed another commit which fixes this bug. @warsaw Tested the snapshot of my changes with lipy-fabric, which has Python 3.6 as a supported version, and the pytest task was skipped for Python 3.7, coverage was run for Python 3.7 (default version), and pytest was run for Python 3.6. Which is the desired behavior.