-
Notifications
You must be signed in to change notification settings - Fork 31k
Show failed tests on CircleCI layout in a better way #25895
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
Conversation
.circleci/create_circleci_config.py
Outdated
| test_command = f"({test_command}) || true" | ||
| else: | ||
| test_command += " | tee tests_output.txt" | ||
| test_command += " | tee tests_output.txt || true" |
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.
This step will always succeed. This is not ideal, but it's necessary for the next step (Check test results) to run (when some tests fail).
| check_test_command = f'if [ -s reports/tests_{self.name}/failures_short.txt ]; ' | ||
| check_test_command += 'then echo "Some test failed!"; echo ""; ' | ||
| check_test_command += f'cat reports/tests_{self.name}/failures_short.txt; ' | ||
| check_test_command += 'echo ""; echo ""; ' | ||
|
|
||
| py_command = f'import os; fp = open("reports/tests_{self.name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith("FAILED ")]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()' | ||
| check_test_command += f"$(python3 -c '{py_command}'); " | ||
|
|
||
| check_test_command += f'cat summary_short.txt; exit -1; ' | ||
| check_test_command += f'elif [ -s reports/tests_{self.name}/stats.txt ]; then echo "All tests pass!"; ' | ||
|
|
||
| # return code `124` means the previous (pytest run) step is timeout | ||
| if self.name == "pr_documentation_tests": | ||
| checkout_doctest_command = 'if [ -s reports/tests_pr_documentation_tests/failures_short.txt ]; ' | ||
| checkout_doctest_command += 'then echo "some test failed"; ' | ||
| checkout_doctest_command += 'cat reports/tests_pr_documentation_tests/failures_short.txt; ' | ||
| checkout_doctest_command += 'cat reports/tests_pr_documentation_tests/summary_short.txt; exit -1; ' | ||
| checkout_doctest_command += 'elif [ -s reports/tests_pr_documentation_tests/stats.txt ]; then echo "All tests pass!"; ' | ||
| checkout_doctest_command += 'elif [ -f 124.txt ]; then echo "doctest timeout!"; else echo "other fatal error)"; exit -1; fi;' | ||
| steps.append({"run": {"name": "Check doctest results", "command": checkout_doctest_command}}) | ||
| check_test_command += 'elif [ -f 124.txt ]; then echo "doctest timeout!"; ' | ||
|
|
||
| check_test_command += 'else echo "other fatal error"; exit -1; fi;' | ||
| check_test_command += 'echo ""; ' | ||
|
|
||
| steps.append({"run": {"name": "Check test results", "command": check_test_command}}) |
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.
A bit ugly, but just to show the failed (and only failed) tests.
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.
So far I put failures_short.tx. We can use failures_long.tx if you prefer.
|
The documentation is not available anymore as the PR was closed or merged. |
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.
I'm not 100% sure there is a lot of difference between this and looking at the artifacts. Also if we do this, we could also remove the call to | tee following #23027.
This way you can either have a nice looking output on the page or go and check the artifacts.
|
No problem to close if you maintainers don't feel it makes navigation (even slightly) better/faster. |
|
I'm actually in favor if we also remove tee 😉 |
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.
The output is so much better - thank you!
|
@amyeroberts BTW, the |
|
No more tea Sir, sorry. |
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.
|
I need a run (page) that already has such colors and format. Personally, I don't feel it's necessary to have it - as we (mostly if not always) care the failing ones. The new step already give ONLY the failed tests without the passing and skipped one - so the color doesn't matter (at least for me). I would move on to merge this PR as you and amy is OK with the changes. For the color thing, if you can provide a run page, I could probably give it a try in the future. |
|
Sure 😉 feel free to merge! |
|
We do have color (on the test run step, not the new test result showing step), but it only show the failing ones. See here. On current main, no RED color at all.
|
|
Happy for |
|
Perfect! |
* update * update * fix --------- Co-authored-by: ydshieh <[email protected]>


What does this PR do?
I am not sure if this will helps the navigation (much), but at least for the team members to try.
A new step is added to show the (only faiiled) test results, and it looks like

The
Run testsstep won't fail now (otherwise we can't have the newCheck test resultsstep), but the new step will (if there is indeed a failed test).For a job run page, see here
WDYT?