Catch #61 with tests and fix
[EVA-2020-02-2.git] / library / tests / conftest.py
index b026172cb589e582056dd62ed84dc13bf6b791cf..8a5c54c5a60f299794035e649bfdbd91db8ca060 100644 (file)
@@ -14,6 +14,23 @@ class SMBusFakeDevice(MockSMBus):
         self.regs[0x00:0x01] = 0x0f, 0x00\r
 \r
 \r
         self.regs[0x00:0x01] = 0x0f, 0x00\r
 \r
 \r
+@pytest.fixture(scope='function', autouse=True)\r
+def cleanup():\r
+    yield None\r
+    try:\r
+        del sys.modules['enviroplus']\r
+    except KeyError:\r
+        pass\r
+    try:\r
+        del sys.modules['enviroplus.noise']\r
+    except KeyError:\r
+        pass\r
+    try:\r
+        del sys.modules['enviroplus.gas']\r
+    except KeyError:\r
+        pass\r
+\r
+\r
 @pytest.fixture(scope='function', autouse=False)\r
 def GPIO():\r
     """Mock RPi.GPIO module."""\r
 @pytest.fixture(scope='function', autouse=False)\r
 def GPIO():\r
     """Mock RPi.GPIO module."""\r