diff --git a/tests/conftest.py b/tests/conftest.py index 127f41df94..0203a07259 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/test_cli.py b/tests/unit_tests/cli/test_cli.py similarity index 98% rename from tests/unit_tests/test_cli.py rename to tests/unit_tests/cli/test_cli.py index 53a7a9e392..93a01d0c92 100644 --- a/tests/unit_tests/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)