Commit 9455f81c authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Tests for logger problem with standalone dev/test

Showing with 10 additions and 4 deletions
+10 -4
from abc import ABC, abstractmethod
import numpy as np
from ohmpi.logging_setup import create_stdout_logger
import time
......
......@@ -6,7 +6,8 @@ import minimalmodbus # noqa
import os
from ohmpi.utils import get_platform
from gpiozero import CPUTemperature # noqa
import warnings
warnings.filterwarnings("error")
class Ctl(CtlAbstract):
def __init__(self, **kwargs):
......@@ -22,12 +23,18 @@ class Ctl(CtlAbstract):
super().__init__(**kwargs)
self.interfaces = dict()
# I2C
self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa
try:
self.interfaces['i2c'] = busio.I2C(board.SCL, board.SDA) # noqa
except RuntimeWarning:
pass
# Extended I2C
try:
self.interfaces['i2c_ext'] = ExtendedI2C(4) # 4 is defined
except RuntimeWarning:
pass
except Exception as e:
self.exec_logger.warning(f'Could not initialize Extended I2C:\n{e}')
# modbus
......
......@@ -9,7 +9,6 @@ from ohmpi.compressed_sized_timed_rotating_handler import CompressedSizedTimedRo
import sys
from termcolor import colored
def add_logging_level(level_name, level_num, method_name=None):
"""
Comprehensively adds a new logging level to the `logging` module and the
......@@ -72,6 +71,7 @@ def create_stdout_logger(name):
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
print(logger.
return logger
......
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