class Sidekiq::Testing

def __set_test_mode(mode)

all threads. Calling with a block only affects the current Thread.
Calling without a block sets the global test mode, affecting
def __set_test_mode(mode)
  if block_given?
    # Reentrant testing modes will lead to a rat's nest of code which is
    # hard to reason about. You can set the testing mode once globally and
    # you can override that global setting once per-thread.
    raise TestModeAlreadySetError, "Nesting test modes is not supported" if __local_test_mode
    self.__local_test_mode = mode
    begin
      yield
    ensure
      self.__local_test_mode = nil
    end
  else
    self.__global_test_mode = mode
  end
end