Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Oct 15, 2024
1 parent 938dd39 commit 7e448ee
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/unit_tests/beamlines/i24/serial/test_log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from pathlib import Path
from unittest.mock import patch
from unittest.mock import MagicMock, patch

import pytest

Expand Down Expand Up @@ -45,6 +45,19 @@ def test_basic_logging_config(dummy_logger):
assert dummy_logger.handlers[0].level == logging.INFO


def test_integrate_bluesky_logs():
mock_dodal_logger = MagicMock()
with (
patch("mx_bluesky.beamlines.i24.serial.log.bluesky_logger") as mock_bluesky_log,
patch(
"mx_bluesky.beamlines.i24.serial.log.ophyd_async_logger"
) as mock_ophyd_log,
):
log._integrate_bluesky_logs(mock_dodal_logger)
assert mock_bluesky_log.parent == mock_dodal_logger
assert mock_ophyd_log.parent == mock_dodal_logger


@patch("mx_bluesky.beamlines.i24.serial.log._integrate_bluesky_logs")
def test_default_logging_setup_removes_dodal_stream(mock_integrate_logs):
with patch("mx_bluesky.beamlines.i24.serial.log.dodal_logger") as mock_dodal_logger:
Expand Down

0 comments on commit 7e448ee

Please sign in to comment.