Skip to content

Move options to common group, and add help text for options#118

Merged
ngoldbaum merged 4 commits into
Quansight-Labs:mainfrom
nickodell:njo-help
Aug 18, 2025
Merged

Move options to common group, and add help text for options#118
ngoldbaum merged 4 commits into
Quansight-Labs:mainfrom
nickodell:njo-help

Conversation

@nickodell

Copy link
Copy Markdown
Contributor

This PR aims to improve two things.

First, currently some options are in a dedicated 'run-parallel' section, but other options are in the 'Custom options' section. This seems confusing.

run-parallel:
  --parallel-threads=PARALLEL_THREADS
                        Set the number of threads used to execute each test concurrently.
  --iterations=ITERATIONS
                        Set the number of iterations that each thread will run.

Custom options:
  --skip-thread-unsafe=SKIP_THREAD_UNSAFE
                        Whether to skip running thread-unsafe tests
  --mark-warnings-as-unsafe
  --mark-ctypes-as-unsafe
  --mark-hypothesis-as-unsafe
  --ignore-gil-enabled
  --lsof                Run FD checks if lsof is available
  --runpytest={inprocess,subprocess}
                        Run pytest sub runs in tests using an 'inprocess' or 'subprocess' (python -m main) method

This can be improved by moving all of the options to the same group.

Second, some options could use help text to describe what they do. I also added documentation about the default behavior, in cases where it wasn't obvious.

  • For --skip-thread-unsafe: I tried to clarify that the the alternative to skipping thread unsafe tests is running them in a single thread, not ignoring the thread safety problem.
  • For --mark-warnings-as-unsafe: a user might think that if they don't pass this option, then warnings will not be marked as unsafe. However, this is not true. Also, I tried to clarify that the thing it reacts to is not warnings, per se, but warnings capture.
  • For --mark-ctypes-as-unsafe: I added a similar note, but was worried it might imply that we check the C code that ctypes is calling as being thread-safe, which we don't, so I added the text "(but not the underlying C code)"
  • For --ignore-gil-enabled: I added a note about what exactly this option protects against. I tried to emphasize that users who are running GIL enabled builds don't need to enable this option.

Here is the rendered revised help:

run-parallel:
  --parallel-threads=PARALLEL_THREADS
                        Set the number of threads used to execute each test
                        concurrently. (default: 1)
  --iterations=ITERATIONS
                        Set the number of iterations that each thread will run.
                        (default: 1)
  --skip-thread-unsafe=SKIP_THREAD_UNSAFE
                        Whether to skip running thread-unsafe tests. If not
                        provided, thread-unsafe tests will still run, but only in
                        one thread.
  --mark-warnings-as-unsafe
                        Mark warnings capture, such as pytest.warns(), as thread-
                        unsafe. If not provided, the thread safety of warnings
                        capture will be determined automatically.
  --mark-ctypes-as-unsafe
                        Mark all uses of ctypes as thread-unsafe. If not
                        provided, the thread safety of ctypes (but not the
                        underlying C code) will be determined automatically.
  --mark-hypothesis-as-unsafe
                        Mark hypothesis as thread-unsafe. If not provided, the
                        thread safety of hypothesis will be determined
                        automatically.
  --ignore-gil-enabled  Ignore the GIL becoming enabled in the middle of a test.
                        By default, if the GIL is re-enabled at runtime, pytest
                        will exit with a non-zero exit code. This option has no
                        effect for non-free-threaded builds.

@rgommers

Copy link
Copy Markdown
Member

This will be quite helpful, thanks @nickodell!

@ngoldbaum

Copy link
Copy Markdown
Collaborator

Thanks @nickodell, I really appreciate all the nice cleanups and fixes you've been sending in!

@ngoldbaum ngoldbaum merged commit bdaccca into Quansight-Labs:main Aug 18, 2025
10 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.

3 participants