From 9b327ec096b9ba92b01e08413b7ffa89004f91a9 Mon Sep 17 00:00:00 2001 From: Abigail Emery Date: Thu, 19 Feb 2026 15:17:07 +0000 Subject: [PATCH 1/2] Move cli tests into correct directory --- tests/unit_tests/{ => cli}/test_cli.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit_tests/{ => cli}/test_cli.py (100%) diff --git a/tests/unit_tests/test_cli.py b/tests/unit_tests/cli/test_cli.py similarity index 100% rename from tests/unit_tests/test_cli.py rename to tests/unit_tests/cli/test_cli.py From 683e8b94be124a2926133b404bb4bb61e923375e Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Thu, 26 Feb 2026 11:36:56 +0000 Subject: [PATCH 2/2] Remote trace reloading fixture --- tests/conftest.py | 2 +- tests/unit_tests/cli/test_cli.py | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 127f41df9..0203a0725 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -44,7 +44,7 @@ def clean_event_loop(): return run_engine -@pytest.fixture(scope="session") +@pytest.fixture(scope="session", autouse=True) def exporter() -> JsonObjectSpanExporter: setup_tracing("test", False) exporter = JsonObjectSpanExporter() diff --git a/tests/unit_tests/cli/test_cli.py b/tests/unit_tests/cli/test_cli.py index 53a7a9e39..93a01d0c9 100644 --- a/tests/unit_tests/cli/test_cli.py +++ b/tests/unit_tests/cli/test_cli.py @@ -1,4 +1,3 @@ -import importlib import json import os import uuid @@ -18,7 +17,6 @@ from bluesky_stomp.messaging import StompClient from bluesky_stomp.models import MessageTopic from click.testing import CliRunner -from opentelemetry import trace from ophyd_async.core import AsyncStatus from pydantic import BaseModel from requests.exceptions import ConnectionError @@ -63,18 +61,6 @@ ) -@pytest.fixture(autouse=True) -def reload_opentelemetry_trace_after_tests(): - """Reload opentelemetry.trace after running each test. - - OpenTelemetry only allows one global TracerProvider, however most cli entry-points - overwrite this to set up tracing. As OpenTelemetry does not have any functions to - aid testing, the library init has to be reloaded after each test to avoid errors. - """ - yield - importlib.reload(trace) - - @pytest.fixture def mock_connection() -> Mock: return Mock(spec=Connection)