diff --git a/packages/cmk-agent-based/BUILD b/packages/cmk-agent-based/BUILD index 51835e84b47..38c737906f4 100644 --- a/packages/cmk-agent-based/BUILD +++ b/packages/cmk-agent-based/BUILD @@ -53,7 +53,9 @@ py_doc_test( py_pytest_main( name = "__test__", - tags = ["no-mypy"], + deps = [ + requirement("pytest"), + ], ) py_test( @@ -62,7 +64,7 @@ py_test( srcs = glob(["tests/**/*.py"]) + [":__test__.py"], args = ["--config-file=$(location pyproject.toml)"], data = ["pyproject.toml"], - main = ":__test__.py", + main = "__test__.py", deps = [ ":__test__", ":cmk-agent-based", diff --git a/packages/cmk-agent-based/run b/packages/cmk-agent-based/run index 26fadad2b3f..eca8f204496 100755 --- a/packages/cmk-agent-based/run +++ b/packages/cmk-agent-based/run @@ -8,8 +8,6 @@ set -e JOBS=6 readonly BAZEL_CMD=${BAZEL_CMD:-bazel} readonly ALL_LINTERS=mypy,ruff,bandit -REPO_PATH="$(git rev-parse --show-toplevel)" -readonly REPO_PATH failure() { test ${#@} -eq 0 || echo "$(basename "$0"):" "$@" >&2 @@ -118,7 +116,7 @@ setup_venv() { # Further: uv seems to fall back to clang, see https://github.com/astral-sh/uv/issues/8036 CC="gcc" ${BAZEL_CMD} run //:create_venv # shellcheck source=/dev/null - source "${REPO_PATH}"/.venv_uv/bin/activate + source "$("$BAZEL_CMD" info workspace)"/.venv_uv/bin/activate SETUP_VENV_RAN=yes } @@ -128,14 +126,14 @@ run_clean() { } run_unit_tests() { - "${BAZEL_CMD}" test //packages/cmk-agent-based:all + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format --check --diff pyproject.toml "${BAZEL_CMD}" lint \ --aspect:interactive=false \ - --aspect:config=../../.aspect/cli/config_isort.yaml \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ --diff \ --machine \ :all @@ -143,7 +141,7 @@ run_check_format() { } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-agent-based:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_ruff() { @@ -162,7 +160,7 @@ run_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format pyproject.toml "${BAZEL_CMD}" lint \ --aspect:interactive=false \ - --aspect:config="${REPO_PATH}"/.aspect/cli/config_isort.yaml \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ --fix \ :all "${BAZEL_CMD}" run :format "$(realpath cmk)" "$(realpath tests)" diff --git a/packages/cmk-ccc/run b/packages/cmk-ccc/run index c504b817d96..eca8f204496 100755 --- a/packages/cmk-ccc/run +++ b/packages/cmk-ccc/run @@ -126,7 +126,7 @@ run_clean() { } run_unit_tests() { - "${BAZEL_CMD}" test //packages/cmk-ccc:all + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { @@ -141,7 +141,7 @@ run_check_format() { } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-ccc:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_ruff() { diff --git a/packages/cmk-crypto/BUILD b/packages/cmk-crypto/BUILD index d11eca35129..d6978004378 100644 --- a/packages/cmk-crypto/BUILD +++ b/packages/cmk-crypto/BUILD @@ -2,6 +2,7 @@ load("@aspect_rules_lint//format:defs.bzl", "format_multirun") load("@aspect_rules_py//py:defs.bzl", "py_library", "py_pytest_main", "py_test") load("@cmk_requirements//:requirements.bzl", "requirement") load("@rules_python//python:packaging.bzl", "py_wheel") +load("//bazel/rules:doctest.bzl", "py_doc_test") load("//bazel/rules:package_wheel.bzl", "package_wheel") exports_files([ @@ -33,6 +34,13 @@ py_library( ], ) +py_doc_test( + name = "doctest", + size = "small", + srcs = ["cmk-crypto"], + tags = ["no-mypy"], +) + py_pytest_main( name = "__test__", deps = [ @@ -65,9 +73,7 @@ py_wheel( strip_path_prefixes = ["packages/cmk-crypto"], # TODO: Duplicated from pyproject.toml version = "0.9.0", - deps = [ - ":cmk-crypto", - ], + deps = [":cmk-crypto"], ) package_wheel( diff --git a/packages/cmk-crypto/run b/packages/cmk-crypto/run index 9e558b22b47..eca8f204496 100755 --- a/packages/cmk-crypto/run +++ b/packages/cmk-crypto/run @@ -116,7 +116,7 @@ setup_venv() { # Further: uv seems to fall back to clang, see https://github.com/astral-sh/uv/issues/8036 CC="gcc" ${BAZEL_CMD} run //:create_venv # shellcheck source=/dev/null - source "$(bazel info workspace)"/.venv_uv/bin/activate + source "$("$BAZEL_CMD" info workspace)"/.venv_uv/bin/activate SETUP_VENV_RAN=yes } @@ -126,18 +126,22 @@ run_clean() { } run_unit_tests() { - "${BAZEL_CMD}" test //packages/cmk-crypto:all + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format --check --diff pyproject.toml - setup_venv - ruff check --select I --diff cmk tests - ruff format --check --diff cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --diff \ + --machine \ + :all + "${BAZEL_CMD}" run :format.check "$(realpath cmk)" "$(realpath tests)" } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-crypto:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_ruff() { diff --git a/packages/cmk-graphing/BUILD b/packages/cmk-graphing/BUILD index 7cca5a79922..4e18df62bc3 100644 --- a/packages/cmk-graphing/BUILD +++ b/packages/cmk-graphing/BUILD @@ -1,5 +1,8 @@ -load("@aspect_rules_py//py:defs.bzl", "py_library") +load("@aspect_rules_lint//format:defs.bzl", "format_multirun") +load("@aspect_rules_py//py:defs.bzl", "py_library", "py_pytest_main", "py_test") +load("@cmk_requirements//:requirements.bzl", "requirement") load("@rules_python//python:packaging.bzl", "py_wheel") +load("//bazel/rules:doctest.bzl", "py_doc_test") load("//bazel/rules:package_wheel.bzl", "package_wheel") exports_files([ @@ -23,15 +26,44 @@ py_library( visibility = ["//cmk:__pkg__"], ) +py_doc_test( + name = "doctest", + size = "small", + srcs = ["cmk-graphing"], + tags = ["no-mypy"], +) + +py_pytest_main( + name = "__test__", + deps = [ + requirement("pytest"), + ], +) + +py_test( + name = "unit", + size = "small", + srcs = glob(["tests/**/*.py"]) + [":__test__.py"], + main = "__test__.py", + deps = [ + ":__test__", + ":cmk-graphing", + requirement("pytest"), + ], +) + +format_multirun( + name = "format", + python = "@aspect_rules_lint//format:ruff", +) + py_wheel( name = "wheel", distribution = "cmk-graphing", strip_path_prefixes = ["packages/cmk-graphing"], # TODO: Duplicated from pyproject.toml version = "1.0.0", - deps = [ - ":cmk-graphing", - ], + deps = [":cmk-graphing"], ) package_wheel( diff --git a/packages/cmk-graphing/run b/packages/cmk-graphing/run index c5d866aae30..eca8f204496 100755 --- a/packages/cmk-graphing/run +++ b/packages/cmk-graphing/run @@ -7,7 +7,7 @@ set -e JOBS=6 readonly BAZEL_CMD=${BAZEL_CMD:-bazel} -readonly ALL_LINTERS=mypy,pylint,bandit +readonly ALL_LINTERS=mypy,ruff,bandit failure() { test ${#@} -eq 0 || echo "$(basename "$0"):" "$@" >&2 @@ -35,7 +35,7 @@ parse_options() { RUN_UNIT_TESTS=no RUN_CHECK_FORMAT=no RUN_MYPY=no - RUN_PYLINT=no + RUN_RUFF=no RUN_BANDIT=no RUN_FORMAT=no RUN_DOCUMENTATION=no @@ -78,7 +78,7 @@ parse_options() { RUN_UNIT_TESTS=yes RUN_CHECK_FORMAT=yes RUN_MYPY=yes - RUN_PYLINT=yes + RUN_RUFF=yes RUN_BANDIT=yes shift ;; @@ -107,7 +107,7 @@ parse_options() { esac done - readonly RUN_CLEAN RUN_UNIT_TESTS RUN_CHECK_FORMAT RUN_MYPY RUN_PYLINT RUN_BANDIT RUN_FORMAT RUN_DOCUMENTATION JOBS + readonly RUN_CLEAN RUN_UNIT_TESTS RUN_CHECK_FORMAT RUN_MYPY RUN_RUFF RUN_BANDIT RUN_FORMAT RUN_DOCUMENTATION JOBS } setup_venv() { @@ -116,7 +116,7 @@ setup_venv() { # Further: uv seems to fall back to clang, see https://github.com/astral-sh/uv/issues/8036 CC="gcc" ${BAZEL_CMD} run //:create_venv # shellcheck source=/dev/null - source "$(bazel info workspace)"/.venv_uv/bin/activate + source "$("$BAZEL_CMD" info workspace)"/.venv_uv/bin/activate SETUP_VENV_RAN=yes } @@ -126,24 +126,26 @@ run_clean() { } run_unit_tests() { - setup_venv - pytest + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format --check --diff pyproject.toml - setup_venv - ruff check --select I --diff cmk tests - ruff format --check --diff cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --diff \ + --machine \ + :all + "${BAZEL_CMD}" run :format.check "$(realpath cmk)" "$(realpath tests)" } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-graphing:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } -run_pylint() { - setup_venv - PYTHONPATH=. pylint --jobs="${JOBS}" cmk tests +run_ruff() { + "${BAZEL_CMD}" lint :all } run_bandit() { @@ -156,9 +158,12 @@ run_bandit() { run_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format pyproject.toml - setup_venv - ruff check --select I --fix cmk tests - ruff format cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --fix \ + :all + "${BAZEL_CMD}" run :format "$(realpath cmk)" "$(realpath tests)" } run_documentation() { @@ -174,7 +179,7 @@ main() { test ${RUN_UNIT_TESTS} = yes && run_unit_tests test ${RUN_CHECK_FORMAT} = yes && run_check_format test ${RUN_MYPY} = yes && run_mypy - test ${RUN_PYLINT} = yes && run_pylint + test ${RUN_RUFF} = yes && run_ruff test ${RUN_BANDIT} = yes && run_bandit test ${RUN_DOCUMENTATION} = yes && run_documentation test ${RUN_FORMAT} = yes && run_format diff --git a/packages/cmk-server-side-calls/BUILD b/packages/cmk-server-side-calls/BUILD index 16f08fb3009..4bffd0d2a46 100644 --- a/packages/cmk-server-side-calls/BUILD +++ b/packages/cmk-server-side-calls/BUILD @@ -1,5 +1,8 @@ -load("@aspect_rules_py//py:defs.bzl", "py_library") +load("@aspect_rules_lint//format:defs.bzl", "format_multirun") +load("@aspect_rules_py//py:defs.bzl", "py_library", "py_pytest_main", "py_test") +load("@cmk_requirements//:requirements.bzl", "requirement") load("@rules_python//python:packaging.bzl", "py_wheel") +load("//bazel/rules:doctest.bzl", "py_doc_test") load("//bazel/rules:package_wheel.bzl", "package_wheel") exports_files([ @@ -20,15 +23,47 @@ py_library( visibility = ["//cmk:__pkg__"], ) +py_doc_test( + name = "doctest", + size = "small", + srcs = ["cmk-server-side-calls"], + tags = ["no-mypy"], + # TODO: There should be *no* imports in doctests! + deps = [requirement("pydantic")], +) + +py_pytest_main( + name = "__test__", + deps = [ + requirement("pytest"), + ], +) + +py_test( + name = "unit", + size = "small", + srcs = glob(["tests/**/*.py"]) + [":__test__.py"], + main = "__test__.py", + deps = [ + ":__test__", + ":cmk-server-side-calls", + requirement("pydantic"), + requirement("pytest"), + ], +) + +format_multirun( + name = "format", + python = "@aspect_rules_lint//format:ruff", +) + py_wheel( name = "wheel", distribution = "cmk-server-side-calls", strip_path_prefixes = ["packages/cmk-server-side-calls"], # TODO: Duplicated from pyproject.toml version = "1.0.0", - deps = [ - ":cmk-server-side-calls", - ], + deps = [":cmk-server-side-calls"], ) package_wheel( diff --git a/packages/cmk-server-side-calls/run b/packages/cmk-server-side-calls/run index 3b902000b31..eca8f204496 100755 --- a/packages/cmk-server-side-calls/run +++ b/packages/cmk-server-side-calls/run @@ -7,7 +7,7 @@ set -e JOBS=6 readonly BAZEL_CMD=${BAZEL_CMD:-bazel} -readonly ALL_LINTERS=mypy,pylint,bandit +readonly ALL_LINTERS=mypy,ruff,bandit failure() { test ${#@} -eq 0 || echo "$(basename "$0"):" "$@" >&2 @@ -35,7 +35,7 @@ parse_options() { RUN_UNIT_TESTS=no RUN_CHECK_FORMAT=no RUN_MYPY=no - RUN_PYLINT=no + RUN_RUFF=no RUN_BANDIT=no RUN_FORMAT=no RUN_DOCUMENTATION=no @@ -78,7 +78,7 @@ parse_options() { RUN_UNIT_TESTS=yes RUN_CHECK_FORMAT=yes RUN_MYPY=yes - RUN_PYLINT=yes + RUN_RUFF=yes RUN_BANDIT=yes shift ;; @@ -107,7 +107,7 @@ parse_options() { esac done - readonly RUN_CLEAN RUN_UNIT_TESTS RUN_CHECK_FORMAT RUN_MYPY RUN_PYLINT RUN_BANDIT RUN_FORMAT RUN_DOCUMENTATION JOBS + readonly RUN_CLEAN RUN_UNIT_TESTS RUN_CHECK_FORMAT RUN_MYPY RUN_RUFF RUN_BANDIT RUN_FORMAT RUN_DOCUMENTATION JOBS } setup_venv() { @@ -116,7 +116,7 @@ setup_venv() { # Further: uv seems to fall back to clang, see https://github.com/astral-sh/uv/issues/8036 CC="gcc" ${BAZEL_CMD} run //:create_venv # shellcheck source=/dev/null - source "$(bazel info workspace)"/.venv_uv/bin/activate + source "$("$BAZEL_CMD" info workspace)"/.venv_uv/bin/activate SETUP_VENV_RAN=yes } @@ -126,24 +126,26 @@ run_clean() { } run_unit_tests() { - setup_venv - pytest + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format --check --diff pyproject.toml - setup_venv - ruff check --select I --diff cmk tests - ruff format --check --diff cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --diff \ + --machine \ + :all + "${BAZEL_CMD}" run :format.check "$(realpath cmk)" "$(realpath tests)" } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-server-side-calls:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } -run_pylint() { - setup_venv - PYTHONPATH=. pylint --jobs="${JOBS}" cmk tests +run_ruff() { + "${BAZEL_CMD}" lint :all } run_bandit() { @@ -156,9 +158,12 @@ run_bandit() { run_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format pyproject.toml - setup_venv - ruff check --select I --fix cmk tests - ruff format cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --fix \ + :all + "${BAZEL_CMD}" run :format "$(realpath cmk)" "$(realpath tests)" } run_documentation() { @@ -174,7 +179,7 @@ main() { test ${RUN_UNIT_TESTS} = yes && run_unit_tests test ${RUN_CHECK_FORMAT} = yes && run_check_format test ${RUN_MYPY} = yes && run_mypy - test ${RUN_PYLINT} = yes && run_pylint + test ${RUN_RUFF} = yes && run_ruff test ${RUN_BANDIT} = yes && run_bandit test ${RUN_DOCUMENTATION} = yes && run_documentation test ${RUN_FORMAT} = yes && run_format diff --git a/packages/cmk-trace/BUILD b/packages/cmk-trace/BUILD index 8a9e137dfca..b90dc863b51 100644 --- a/packages/cmk-trace/BUILD +++ b/packages/cmk-trace/BUILD @@ -1,6 +1,8 @@ -load("@aspect_rules_py//py:defs.bzl", "py_library") +load("@aspect_rules_lint//format:defs.bzl", "format_multirun") +load("@aspect_rules_py//py:defs.bzl", "py_library", "py_pytest_main", "py_test") load("@cmk_requirements//:requirements.bzl", "requirement") load("@rules_python//python:packaging.bzl", "py_wheel") +load("//bazel/rules:doctest.bzl", "py_doc_test") load("//bazel/rules:package_wheel.bzl", "package_wheel") exports_files([ @@ -16,7 +18,6 @@ py_library( "cmk/trace/_propagate.py", "cmk/trace/export.py", "cmk/trace/logs.py", - "cmk/trace/py.typed", ], imports = ["."], visibility = ["//visibility:public"], @@ -29,15 +30,49 @@ py_library( ], ) +py_doc_test( + name = "doctest", + size = "small", + srcs = ["cmk-trace"], + tags = ["no-mypy"], +) + +py_pytest_main( + name = "__test__", + deps = [ + requirement("pytest"), + ], +) + +py_test( + name = "unit", + size = "small", + srcs = glob(["tests/**/*.py"]) + [":__test__.py"], + main = "__test__.py", + deps = [ + ":__test__", + ":cmk-trace", + requirement("opentelemetry-api"), + requirement("opentelemetry-sdk"), + requirement("opentelemetry-exporter-otlp"), + requirement("opentelemetry-exporter-otlp-proto-grpc"), + requirement("opentelemetry-semantic-conventions"), + requirement("pytest"), + ], +) + +format_multirun( + name = "format", + python = "@aspect_rules_lint//format:ruff", +) + py_wheel( name = "wheel", distribution = "cmk-trace", strip_path_prefixes = ["packages/cmk-trace"], # TODO: Duplicated from pyproject.toml version = "1.0.0", - deps = [ - ":cmk-trace", - ], + deps = [":cmk-trace"], ) package_wheel( diff --git a/packages/cmk-trace/cmk/trace/_config.py b/packages/cmk-trace/cmk/trace/_config.py index 8563104b907..d42101a2347 100644 --- a/packages/cmk-trace/cmk/trace/_config.py +++ b/packages/cmk-trace/cmk/trace/_config.py @@ -19,6 +19,12 @@ class TraceSendConfig: def service_namespace_from_config(default_namespace: str, config: Mapping[str, str]) -> str: + """ + >>> service_namespace_from_config("harry", {}) + 'harry' + >>> service_namespace_from_config("harry", {"CONFIG_TRACE_SERVICE_NAMESPACE": "hirsch"}) + 'hirsch' + """ if namespace := config.get("CONFIG_TRACE_SERVICE_NAMESPACE"): return namespace return default_namespace diff --git a/packages/cmk-trace/run b/packages/cmk-trace/run index aa148da882a..eca8f204496 100755 --- a/packages/cmk-trace/run +++ b/packages/cmk-trace/run @@ -116,7 +116,7 @@ setup_venv() { # Further: uv seems to fall back to clang, see https://github.com/astral-sh/uv/issues/8036 CC="gcc" ${BAZEL_CMD} run //:create_venv # shellcheck source=/dev/null - source "$(bazel info workspace)"/.venv_uv/bin/activate + source "$("$BAZEL_CMD" info workspace)"/.venv_uv/bin/activate SETUP_VENV_RAN=yes } @@ -126,24 +126,26 @@ run_clean() { } run_unit_tests() { - setup_venv - pytest + "${BAZEL_CMD}" test "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_check_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format --check --diff pyproject.toml - setup_venv - ruff check --select I --diff cmk tests - ruff format --check --diff cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --diff \ + --machine \ + :all + "${BAZEL_CMD}" run :format.check "$(realpath cmk)" "$(realpath tests)" } run_mypy() { - "${BAZEL_CMD}" build --config=mypy //packages/cmk-trace:all + "${BAZEL_CMD}" build --config=mypy "/${PWD#"$("${BAZEL_CMD}" info workspace)"}:all" } run_ruff() { - setup_venv - ruff check cmk tests + "${BAZEL_CMD}" lint :all } run_bandit() { @@ -156,9 +158,12 @@ run_bandit() { run_format() { command -v taplo >/dev/null && RUST_LOG=warn taplo format pyproject.toml - setup_venv - ruff check --select I --fix cmk tests - ruff format cmk tests + "${BAZEL_CMD}" lint \ + --aspect:interactive=false \ + --aspect:config="$("$BAZEL_CMD" info workspace)"/.aspect/cli/config_isort.yaml \ + --fix \ + :all + "${BAZEL_CMD}" run :format "$(realpath cmk)" "$(realpath tests)" } run_documentation() { diff --git a/packages/cmk-trace/tests/conftest.py b/packages/cmk-trace/tests/conftest.py index eec90b7371a..a80aa92bf08 100644 --- a/packages/cmk-trace/tests/conftest.py +++ b/packages/cmk-trace/tests/conftest.py @@ -11,10 +11,9 @@ @pytest.fixture(name="reset_global_tracer_provider") def _fixture_reset_global_tracer_provider() -> Iterator[None]: - # pylint: disable=protected-access - provider_orig = otel_trace._TRACER_PROVIDER + provider_orig = otel_trace._TRACER_PROVIDER # noqa: SLF001 try: yield finally: - otel_trace._TRACER_PROVIDER_SET_ONCE._done = False - otel_trace._TRACER_PROVIDER = provider_orig + otel_trace._TRACER_PROVIDER_SET_ONCE._done = False # noqa: SLF001 + otel_trace._TRACER_PROVIDER = provider_orig # noqa: SLF001