import logging import pytest import log log_config_path = 'tests/fixtures/logs.yml' def test_enable_logs(): """Test that the log module reads the yaml config file properly. """ log.enable_logs(path=log_config_path) logger = logging.getLogger('test') assert logging.getLoggerClass() == logging.Logger assert logger is not None assert logger.hasHandlers() is True assert logger.getEffectiveLevel() == logging.INFO assert logger.isEnabledFor(logging.INFO) is True def test_invalid_config_path(): """Test that a FileNotFoundError is raised when loading with a wrong path """ with pytest.raises(FileNotFoundError): log.enable_logs('some/invalid/path')