in_testing_environment

(function from pyomo.common.flags)

pyomo.common.flags.in_testing_environment(state=NOTSET)[source]

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)

Return type:

bool