I had a thought (when commenting on #62) that when trying to import GPIO, on an import error we could switch it out for MagicMock. This would mean there wouldn't be any need to set Config.test_mode = True as the mock object would just silently 'run' GPIO methods.
from unittest.mock import MagicMock
try:
import RPi.GPIO as GPIO
except ImportError:
GPIO = MagicMock()
I'm not 100% on this as it feels a bit hacky to use a testing mock object in the main module. Thoughts?
I had a thought (when commenting on #62) that when trying to import
GPIO, on an import error we could switch it out forMagicMock. This would mean there wouldn't be any need to setConfig.test_mode = Trueas the mock object would just silently 'run' GPIO methods.I'm not 100% on this as it feels a bit hacky to use a testing mock object in the main module. Thoughts?