[cpacker#319] fixed error with config with improper include in config.py

added test_log.py. for testing global logging in log.py
This commit is contained in:
Max Blackmer
2024-01-11 10:44:20 -05:00
parent 72d184a5e3
commit abf4fb03bd
2 changed files with 17 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
from log import logger
from memgpt.log import logger
import inspect
import json
import os

16
tests/test_log.py Normal file
View File

@@ -0,0 +1,16 @@
import logging
from memgpt.log import logger
from memgpt.constants import LOGGER_LOG_LEVELS
import pytest
def test_log_debug():
# test setting logging level
assert logging.DEBUG == LOGGER_LOG_LEVELS["DEBUG"]
logger.setLevel(LOGGER_LOG_LEVELS["DEBUG"])
assert logger.isEnabledFor(logging.DEBUG)
# Assert that the message was logged
assert logger.hasHandlers()
logger.debug("This is a Debug message")
assert 1 == 1