MCPcopy
hub / github.com/RasaHQ/rasa / test_cli_valid_logging_configuration

Function test_cli_valid_logging_configuration

tests/utils/test_common.py:224–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222
223
224def test_cli_valid_logging_configuration() -> None:
225 logging_config_file = "data/test_logging_config_files/test_logging_config.yml"
226 configure_logging_from_file(logging_config_file=logging_config_file)
227 rasa_logger = logging.getLogger("rasa")
228
229 handlers = rasa_logger.handlers
230 assert len(handlers) == 1
231 assert isinstance(handlers[0], logging.FileHandler)
232 assert "test_handler" == rasa_logger.handlers[0].name
233
234 logging_message = "This is a test info log."
235 rasa_logger.info(logging_message)
236
237 handler_filename = handlers[0].baseFilename
238 assert Path(handler_filename).exists()
239
240 with open(handler_filename, "r") as logs:
241 data = logs.readlines()
242 logs_dict = json.loads(data[-1])
243 assert logs_dict.get("message") == logging_message
244
245 for key in ["time", "name", "levelname"]:
246 assert key in logs_dict.keys()
247
248
249@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

existsMethod · 0.80
getMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…