-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure pytest actually fails CI on windows #780
Conversation
Codecov Report
@@ Coverage Diff @@
## master #780 +/- ##
=======================================
Coverage 21.51% 21.51%
=======================================
Files 63 63
Lines 8542 8542
Branches 1572 1572
=======================================
Hits 1838 1838
- Misses 6680 6682 +2
+ Partials 24 22 -2 see 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I think it would be worth testing whether |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like my suspicion about only last command's exit code being used is likely correct, see nedbat/coveragepy#1003 and https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
For now, just move coverage run
to a separate step, naming it Run tests and collect coverage
, and rename the existing one Generate coverage reports
.
That should fix pytest not erroring (via coverage) on Windows.
We likely have similar issues all over CI, but that can be fixed properly in a separate PR, preferably by having multi-line test steps error out properly.
It is also possible, but not guaranteed that explicitly setting |
I don't believe that would work, trying to run a Bash shell on a Windows machine. |
Better Google-fu than me! |
That shouldn't be a problem, as git is available (which depend on and include bash), and possibly also msys2/mingw (see actions/runner#497) Your current change should be fine tho, but the xml and report steps should be in the same steps, as I don't expect either of those to ever fail |
Kudos, SonarCloud Quality Gate passed! |
For whatever reason, the error code from
coverage run
is not surfacing to the Windows runner, and therefore the CI is passing despite several unit tests failing.Using
pytest
directly does surface the proper error code and halt CI if any tests fail, so that has been added as a step.coverage run
is still executed, afterpytest
, to generate the necessary information needed forcoverage xml
andcoverage report
. Becausepytest
runs first, the false-negative tests incoverage run
will never be encountered.This fails as expected:
Closes #777