diff --git a/shared/observability/tests/conftest.py b/shared/observability/tests/conftest.py index 93aecf261843a..3815664d04ae0 100644 --- a/shared/observability/tests/conftest.py +++ b/shared/observability/tests/conftest.py @@ -18,4 +18,15 @@ import os +import pytest + os.environ["_AIRFLOW__AS_LIBRARY"] = "true" + + +@pytest.fixture(autouse=True) +def clear_otel_env_vars(monkeypatch): + # These tests run on the CI runner itself, and a runner may export OTEL_* variables for its own + # OpenTelemetry collector (RunsOn does), which take precedence over the Airflow configuration. + for name in list(os.environ): + if name.startswith("OTEL_"): + monkeypatch.delenv(name)