Skip to content

Commit fb0258b

Browse files
abbiemerytpoliaw
andauthored
chore: Move cli tests into correct directory (#1406)
The cli tests were in the root unit test dir, when the cli now has its own module. This makes it match the src layout. The `reload_opentelemetry_trace_after_tests` fixture has been removed as it wasn't working as intended and didn't appear to be needed anymore. If there are issues in the future we will re-address. --------- Co-authored-by: Peter Holloway <peter.holloway@diamond.ac.uk>
1 parent a438d99 commit fb0258b

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def clean_event_loop():
4444
return run_engine
4545

4646

47-
@pytest.fixture(scope="session")
47+
@pytest.fixture(scope="session", autouse=True)
4848
def exporter() -> JsonObjectSpanExporter:
4949
setup_tracing("test", False)
5050
exporter = JsonObjectSpanExporter()
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import importlib
21
import json
32
import os
43
import uuid
@@ -18,7 +17,6 @@
1817
from bluesky_stomp.messaging import StompClient
1918
from bluesky_stomp.models import MessageTopic
2019
from click.testing import CliRunner
21-
from opentelemetry import trace
2220
from ophyd_async.core import AsyncStatus
2321
from pydantic import BaseModel
2422
from requests.exceptions import ConnectionError
@@ -63,18 +61,6 @@
6361
)
6462

6563

66-
@pytest.fixture(autouse=True)
67-
def reload_opentelemetry_trace_after_tests():
68-
"""Reload opentelemetry.trace after running each test.
69-
70-
OpenTelemetry only allows one global TracerProvider, however most cli entry-points
71-
overwrite this to set up tracing. As OpenTelemetry does not have any functions to
72-
aid testing, the library init has to be reloaded after each test to avoid errors.
73-
"""
74-
yield
75-
importlib.reload(trace)
76-
77-
7864
@pytest.fixture
7965
def mock_connection() -> Mock:
8066
return Mock(spec=Connection)

0 commit comments

Comments
 (0)