X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/e9c93677beeb6c6416d8f15aa2bd29ce3cd4b726..f4b2db2d7a5100e67c2f2102537e318b319c5321:/library/tests/test_setup.py diff --git a/library/tests/test_setup.py b/library/tests/test_setup.py index 6b6658c..2aa7b49 100644 --- a/library/tests/test_setup.py +++ b/library/tests/test_setup.py @@ -1,29 +1,3 @@ -import sys -import mock - - -def force_reimport(module): - """Force the module under test to be re-imported. - - Because pytest runs all tests within the same scope (this makes me cry) - we have to do some manual housekeeping to avoid tests polluting each other. - - 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): from enviroplus import gas gas._is_setup = False @@ -85,7 +59,6 @@ def test_gas_read_adc_str(GPIO, smbus): def test_gas_cleanup(GPIO, smbus): - force_reimport('enviroplus.gas') from enviroplus import gas gas.cleanup()