I've created a Tests/helper.py function called running_in_another_thread() that uses a global variable and inspect to determine if a test has already started running in another thread, so that we can return early if we would only like the test to run in one thread at a time.
This is used here in two cases
8492 has found that running a test that calls register_handler at the beginning, and removes the handler at the end, fails when the test is run across multiple threads. My thinking is that if it ok for register_handler to operate across threads, and that it doesn't need to register multiple handlers in parallel. So this PR returns early from the relevant test if it is already running in another thread.
Possible way to help #8492. Alternative to #8501
I've created a Tests/helper.py function called
running_in_another_thread()
that uses a global variable andinspect
to determine if a test has already started running in another thread, so that we can return early if we would only like the test to run in one thread at a time.This is used here in two cases
8492 has found that running a test that calls
register_handler
at the beginning, and removes the handler at the end, fails when the test is run across multiple threads. My thinking is that if it ok forregister_handler
to operate across threads, and that it doesn't need to register multiple handlers in parallel. So this PR returns early from the relevant test if it is already running in another thread.Image.core.set_alignment
doesn't need to be run across multiple threads simultaneously, so this PR returns early.