-
Notifications
You must be signed in to change notification settings - Fork 28
[LLT-6912] log when natlab test passes #1624
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
base: main
Are you sure you want to change the base?
Conversation
7d96c96 to
b34a5d8
Compare
d53878c to
9444002
Compare
9444002 to
43093cc
Compare
43093cc to
bd5f908
Compare
bd5f908 to
6548ced
Compare
mathiaspeters
left a comment
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 like the goal but I don't like this way of implementing it. There should be a way with pytest to execute code before and/or after a test runs. And I think doing it with some pytest harness thing gives us another benefit: we might be able to include the name of the test in the log output so that if a test has a lot of output, you don't have to scroll up to find out which test just finished
100% agreed, I'd suggest using something like pytest_sessionstart / pytest_sessionfinish |
|
@mathiaspeters @gytsto I suggested this solution. In NatLab we observe timeouts(180s) when It takes time to check if the timeout has happened in the test code itself versus cleanup stage. None of the obvious solutions look clean or quick to implement. As a compromise we agreed to just log a line. |
I don't like how this is implemented and I'm pretty sure we will constantly forget to add this line. If you have investigated this in depth and you are sure that there is no better way than to manually add those logs to each tests than I have one requirement. In the test running script on gitlab, add a post processing of the test log so that the overall test job will fail if there not all tests have emitted this log. This way if we forget to add this line, we will not be able to merge such change. |
6548ced to
e277166
Compare
That's a sensible requirement 👍 |
|
Did you try using pytest_runtest_logreport? It's executed after each individual test and gets a TestReport object with which you can print that line like: Or maybe you already tried that? |
|
When the natlab testcase fails, it's useful to quickly identify if the failure is in the test body or in the cleanup. Cleanup failure is a legit failure, we just want to steer the efforts into the right direction without checking python testcase code and the logs. There are other options, such as - checking for I find the printing approach to be very explicit and useful at the end of test body, even though the implementation is not as graceful. |
|
I get the problem now. Let's go with this solution and the extra check that Tomasz suggested |
The nat-lab test logs would fail in cleanup due to timeout. It was hard to figure out if the test logic succeeded. With this print it will be clear that test case succeeded.
5dda42d to
f5b8f1b
Compare
|
There is an idea to rewrite tests to use fixtures and then probably @mathiaspeters idea would work? |
|
If it moves the execution of the |
|
@mathiaspeters @sfraczek I think that would be a valuable refactor - it makes this task much bigger, but if there is nothing urgent now, maybe it's worth to give it a shot? |
Ok but first I will try to make this solution pass and then next week I can see what comes out of adding fixtures. |
Problem
Make it easier to review if failed natlab tests have only failed because of cleanup timeout or other teardown problems
Solution
Log when natlab tests pass "TEST CASE PASSED"
☑️ Definition of Done checklist