Skip to content

Commit

Permalink
(#391) fix logging and LUT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dperl-dls committed Apr 5, 2024
1 parent 19a03bd commit 2de7fa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/devices/unit_tests/util/test_adjuster_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.fixture
def fake_aperture():
FakeAperture = make_fake_device(Aperture)
fake_aperture: Aperture = FakeAperture(name="aperture")
fake_aperture: Aperture = FakeAperture(prefix="", name="aperture")
return fake_aperture


Expand Down
2 changes: 1 addition & 1 deletion tests/plans/test_topup_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@pytest.fixture
def synchrotron() -> Synchrotron:
def synchrotron(RE) -> Synchrotron:
return i03.synchrotron(fake_with_ophyd_sim=True)


Expand Down
15 changes: 6 additions & 9 deletions tests/unit_tests/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest
from graypy import GELFTCPHandler
from ophyd import log as ophyd_log

from dodal import log
from dodal.log import (
Expand Down Expand Up @@ -130,6 +131,10 @@ def test_various_messages_to_graylog_get_beamline_filter(
):
from os import environ

from bluesky.run_engine import RunEngine

RE = RunEngine()

if environ.get("BEAMLINE"):
del environ["BEAMLINE"]
log.beamline_filter = log.BeamlineFilter()
Expand Down Expand Up @@ -157,19 +162,11 @@ def mock_set_up_graylog_handler(logger, host, port):
mock_GELFTCPHandler.emit.assert_called()
assert mock_GELFTCPHandler.emit.call_args.args[0].beamline == "dev"

from dodal.beamlines import i03

_aperture_scatterguard = i03.aperture_scatterguard(
fake_with_ophyd_sim=True, wait_for_connection=True
)
ophyd_log.logger.info("Ophyd log message")
assert mock_GELFTCPHandler.emit.call_args.args[0].name == "ophyd"
assert mock_GELFTCPHandler.emit.call_args.args[0].beamline == "dev"

from bluesky.run_engine import RunEngine

RE = RunEngine()
RE.log.logger.info("RunEngine log message")

assert mock_GELFTCPHandler.emit.call_args.args[0].name == "bluesky"
assert mock_GELFTCPHandler.emit.call_args.args[0].beamline == "dev"

Expand Down

0 comments on commit 2de7fa1

Please sign in to comment.