Add a force_parallel_threads mark#176
Conversation
itamarst
left a comment
There was a problem hiding this comment.
One and a half very minor comments; merge or address, up to you.
| @@ -439,13 +439,21 @@ def pytest_configure(config): | |||
| "using `n` threads. Note that if n is greater than 1, the test " | |||
| "run with this many threads even if the --parallel-threads " | |||
| "command-line argument is not passed. Use parallel_threads_limit " | |||
There was a problem hiding this comment.
Maybe "Use parallel_threads_limit marker" and next line "force_parallel_threads marker" just so it's clear what you're referring to.
| @@ -22,15 +22,16 @@ def auto_or_int(val): | |||
|
|
|||
| def get_num_workers(item): | |||
There was a problem hiding this comment.
Probably not worth fixing: the reason marker_used is set only when n_workers == 1 for some markers only makes sense if you read the code in the caller and understand what it's being used for. Seems like it could always be set when a marker is used (irrespective of n_workers == 1), and it wouldn't affect the caller's behavior?
Definitely not worth doing: For a semantically more meaningful return in Rust I'd use an enum with two variants (NumThreads(n) and ThreadUnsafe) and a method get_n_threads() that returns n for the former and 1 for the latter. I forget if Python Enums even let you do that sort of thing, though 😁
There was a problem hiding this comment.
Yeah the code got a little spaghettified in here unfortunately :(
I'm going to ignore this refactoring suggestion for a future date.
Fixes #173.
For people who want the old behavior of
parallel_threadsand find the deprecation warning troublesome.