Skip to content

Commit

Permalink
Make a start on log tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jun 16, 2023
1 parent e0f997c commit 32054b5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/I24/serial/test_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
from unittest.mock import patch

import pytest

from mx_bluesky.I24.serial import log


@pytest.fixture
def dummy_logger():
logger = logging.getLogger("I24ssx.dummy")
yield logger


@patch("mx_bluesky.I24.serial.log.Path.mkdir")
def test_logging_file_path(mock_dir):
log_path = log._get_logging_file_path()
assert mock_dir.call_count == 1
assert log_path.as_posix() == "tmp/logs"


@patch("mx_bluesky.I24.serial.log.Path.mkdir")
@patch("mx_bluesky.I24.serial.log.logging.FileHandler")
def test_log_config(mock_fh, mock_dir, dummy_logger):
log.config("dummy.log")
assert mock_fh.call_count == 1

0 comments on commit 32054b5

Please sign in to comment.