In general, you use an environment variable for this kind of behavior. I would strongly urge against it because that kinda negates the point of being tested. It sounds like you have an XY problem. You probably want to use some sort of mock object instead of having the module provide the mocking.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?