Skipped tests should not make the badge red
What Happened?
When creating badges using "--junit-xml" option, if there is any skipped test, the badge is red.
Expected result
Skipped tests should not be considered as failures or errors as they are usually skipped for good reasons. Badges for test suites with skipped tests and without errors or failures should be green, as considered in pytest documentation for example:
A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping tests that depend on an external resource which is not available at the moment (for example a database).
Solution
In badges_test.py, replace:
test_badge_color = 'red' if total_not_passed > 0 else 'green'
by:
test_badge_color = 'red' if test_results[1] + test_results[2] > 0 else 'green'
Priority/Severity
-
Medium (anything that negatively affects the user experience)