Skip to content

Commit

Permalink
Remove log test that broke everything else
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jun 19, 2023
1 parent 047b1ed commit ebd43cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/mx_bluesky/I24/serial/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _get_logging_file_path() -> Path:
return logging_path


def config(logfile: str | None = None, write_mode: str = "a"):
def config(logfile: str | None = None, write_mode: str = "a", delayed: bool = False):
"""
Configure the logging.
Expand All @@ -75,7 +75,7 @@ def config(logfile: str | None = None, write_mode: str = "a"):
"%(asctime)s %(levelname)s: \t%(message)s",
datefmt="%d-%m-%Y %I:%M:%S",
)
FH = logging.FileHandler(logs, mode=write_mode, encoding="utf-8")
FH = logging.FileHandler(logs, mode=write_mode, encoding="utf-8", delay=delayed)
FH.setLevel(logging.DEBUG)
FH.setFormatter(fileFormatter)
logger.addHandler(FH)
3 changes: 2 additions & 1 deletion tests/I24/serial/extruder/test_extruder_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def test_scrape_parameter_file():
@patch(
"mx_bluesky.I24.serial.extruder.i24ssx_Extruder_Collect_py3v2.sup.get_detector_type"
)
def test_initialise_extruder(fake_det, fake_caput, fake_caget):
@patch("mx_bluesky.I24.serial.extruder.i24ssx_Extruder_Collect_py3v2.logger")
def test_initialise_extruder(fake_log, fake_det, fake_caput, fake_caget):
fake_caget.return_value = "/path/to/visit"
fake_det.return_value = Eiger()
initialise_extruderi24()
Expand Down
16 changes: 0 additions & 16 deletions tests/I24/serial/test_log.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
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 ebd43cc

Please sign in to comment.