-def test_gas_setup():
- sys.modules['RPi'] = mock.Mock()
- sys.modules['RPi.GPIO'] = mock.Mock()
- smbus = mock.Mock()
- smbus.SMBus = SMBusFakeDevice
- sys.modules['smbus'] = smbus
+ Since conftest.py already does some sys.modules mangling I see no reason not to
+ do the same thing here.
+ """
+ if "." in module:
+ steps = module.split(".")
+ else:
+ steps = [module]
+
+ for i in range(len(steps)):
+ module = ".".join(steps[0:i + 1])
+ try:
+ del sys.modules[module]
+ except KeyError:
+ pass
+
+
+def test_gas_setup(GPIO, smbus):