-
Notifications
You must be signed in to change notification settings - Fork 339
Fix the lister when running in parallel #2233
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
It was not prepared for receiving updates from multiple files concurrently and some results were lost.
Claude finished @gaborcsardi's task —— View job Code ReviewTodo List
The fix correctly addresses parallel execution issues by:
Potential issue: In Otherwise, the parallel safety implementation looks solid. |
self$running <- new.env(parent = emptyenv()) | ||
}, | ||
|
||
start_test = function(context, test) { |
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 don't know if it's important, but to fully handle nested tests (which always existed via describe()
and it()
but are now fleshed out for test_that()
too), start_test()
might be called multiple times before end_test()
; i.e. tests are a stack now.
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.
Yes, that is actually how the parallel reporting works. We call start_file()
and start_test()
every time we get a result from a subprocess.
But do you also call end_test()
multiple times, or no?
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.
Right — each test always generates one start_test()
and one end_test()
but there might be multiple starts before you get to the match ends. There's a tests/testthat/reporter/nested.R
you can use to test if needed.
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 is essentially what he new test case I added does as well. (In addition to doing all this "concurrently".) So this should be fine. (Also, all tests pass, that means it is fine, no?)
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.
Yeah, seems fine. I mostly wanted to make sure that you were aware of this change to the reporter API because I keep forgetting about it.
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.
TBH, I never really looked at how describe()
tests are different, so I indeed wasn't aware of this.
But the logic should be the same as before for non-parallel runs, and parallel runs should now produce the same results as non-parallel runs. This was my reasoning for this PR being correct.
It was not prepared for receiving updates from multiple files concurrently and some results were lost.