()
| 222 | |
| 223 | |
| 224 | def 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( |
nothing calls this directly
no test coverage detected
searching dependent graphs…