If you have something that should only run in testing, perhaps your test harness should set the global variable appropriately, no?