-
Notifications
You must be signed in to change notification settings - Fork 183
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
Future request: Multi-threaded tests should be explicit #39
Comments
as mentioned in issue 24, I think that multithreading can be done at the testfile level. That would also be a perfect border for your case of depending tests. Or, also mentioned, at the top-level 'describe' functions, but in that case some documentation on this subject would be required. |
Yeah; I think we've decided that the threading will be per-file, with a flag to disable threads. |
as a request; check on Lanes being installed first, if not run sequential, otherwise use Lanes (unless flagged not to) |
I agree with the check idea. We should thread by default if lanes is installed, with an option to disable threading. If your tests break when threaded you're doing them wrong and deserve to have to do extra work to run your tests slower =) |
I vehemently disagree with a separate syntax for threaded tests. It clutters things. |
if you spawn threads on the file level, then I don't see why it would be necessary at all to have a separate syntax. Keep shared state at the file level and document the approach to multithreading. Syntax can stay as is. |
Hello Mr. DorianGray I want to know when to perform multithreaded testing? can you please shed some insight on the same? |
@DorianGray mentions in #24:
While I agree with the sentiment (slow tests = bad) I'm opening this issue to express my disagreement on the implementation.
I don't think buste should be "threaded by default". My main reason is that my tests usually require some kind of shared state, like so:
The test case above runs fine in single-threaded mode. Even if the order of the tests is randomized, it will still pass. But it can fail randomly if the two tests are run in parallel. This would surprise most people coming from other testing libraries.
Note that while in this case I'm using a local variable to represent shared state, in other cases it's an external element, such a library, over which I might not have full control of - more notably, it might not be multi-thread capable.
I'm not 100% sure of how other libraries deal with multi-threading, but I think the cautious thing would be using a separate syntax for those tests that could be run in paralel. For example via a new
multi_threaded
method:Something explicit like this will ensure that the programmer "declares that he knows where he's running into" , so multi-threading doesn't take him "by surprise".
The text was updated successfully, but these errors were encountered: