Skip to content

Add a force_parallel_threads mark#176

Merged
ngoldbaum merged 2 commits into
Quansight-Labs:mainfrom
ngoldbaum:force-parallel-threads
May 21, 2026
Merged

Add a force_parallel_threads mark#176
ngoldbaum merged 2 commits into
Quansight-Labs:mainfrom
ngoldbaum:force-parallel-threads

Conversation

@ngoldbaum

Copy link
Copy Markdown
Collaborator

Fixes #173.

For people who want the old behavior of parallel_threads and find the deprecation warning troublesome.

@itamarst itamarst left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One and a half very minor comments; merge or address, up to you.

Comment thread src/pytest_run_parallel/plugin.py Outdated
@@ -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 "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 😁

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the code got a little spaghettified in here unfortunately :(

I'm going to ignore this refactoring suggestion for a future date.

@ngoldbaum ngoldbaum merged commit 4169fca into Quansight-Labs:main May 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is @pytest.mark.parallel_threads intentionally deprecated?

2 participants