Skip to content

Commit 1495fce

Browse files
committed
Bench(fix[lgtm]): Skip the optional-dependency tests on what they import
why: Both tests guard on `opentelemetry`, but that namespace package arrives transitively, so the guard passes wherever libtmux is installed. What the modules under test actually import is `opentelemetry.sdk`, the OTLP exporters, and rampa, all of which ship only in the optional `otel` group -- which CI does not install. The guard therefore never fired and the tests failed on import instead of skipping, which was the stated intent. what: - Guard on `opentelemetry.sdk` rather than the namespace package - Guard the load scenario on rampa as well, since it imports both Verified in both directions: without the group the two skip, and with it installed they still run and pass rather than being silently disabled.
1 parent f224e44 commit 1495fce

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/test_lgtm_dashboards.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,11 @@ def test_telemetry_doctests_execute() -> None:
277277
"""
278278
import doctest
279279

280-
pytest.importorskip("opentelemetry", reason="otel dependency group not installed")
280+
# The namespace package arrives transitively; the SDK is what this module
281+
# actually imports, and it only ships in the optional group.
282+
pytest.importorskip(
283+
"opentelemetry.sdk", reason="otel dependency group not installed"
284+
)
281285

282286
spec = importlib.util.spec_from_file_location("telemetry", _LGTM / "telemetry.py")
283287
assert spec is not None
@@ -463,7 +467,10 @@ def test_a_failing_load_setup_is_attempted_once(
463467
input into thousands of servers and enough threads to saturate the machine.
464468
It did exactly that once, which is why this is pinned.
465469
"""
466-
pytest.importorskip("opentelemetry", reason="otel dependency group not installed")
470+
pytest.importorskip(
471+
"opentelemetry.sdk", reason="otel dependency group not installed"
472+
)
473+
pytest.importorskip("rampa", reason="otel dependency group not installed")
467474

468475
monkeypatch.syspath_prepend(str(_LGTM))
469476
spec = importlib.util.spec_from_file_location("load_tmux", _LGTM / "load_tmux.py")

0 commit comments

Comments
 (0)