Commit b556b659 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Tests for logger problem with standalone dev/test

Showing with 4 additions and 1 deletion
+4 -1
...@@ -7,7 +7,7 @@ import os ...@@ -7,7 +7,7 @@ import os
from ohmpi.utils import get_platform from ohmpi.utils import get_platform
from gpiozero import CPUTemperature # noqa from gpiozero import CPUTemperature # noqa
import warnings import warnings
warnings.filterwarnings("error")
class Ctl(CtlAbstract): class Ctl(CtlAbstract):
def __init__(self, **kwargs): def __init__(self, **kwargs):
...@@ -24,6 +24,7 @@ class Ctl(CtlAbstract): ...@@ -24,6 +24,7 @@ class Ctl(CtlAbstract):
super().__init__(**kwargs) super().__init__(**kwargs)
self.interfaces = dict() self.interfaces = dict()
warnings.filterwarnings("error") # to filter out adafruit warning about setting I2C frequency
# I2C # I2C
try: try:
self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa
...@@ -37,6 +38,8 @@ class Ctl(CtlAbstract): ...@@ -37,6 +38,8 @@ class Ctl(CtlAbstract):
pass pass
except Exception as e: except Exception as e:
self.exec_logger.warning(f'Could not initialize Extended I2C:\n{e}') self.exec_logger.warning(f'Could not initialize Extended I2C:\n{e}')
warnings.resetwarnings()
# modbus # modbus
try: try:
self.interfaces['modbus'] = minimalmodbus.Instrument(port=modbus_port, slaveaddress=modbus_slave_address) self.interfaces['modbus'] = minimalmodbus.Instrument(port=modbus_port, slaveaddress=modbus_slave_address)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment