Return True if we are currently running in a “testing” environment
This currently includes if nose, nose2, or pytest are
running (imported).
Parameters:
state (bool or None) – If provided, sets the current state of the testing environment
(Setting to None reverts to the normal interrogation of
sys.modules)