diff --git a/ddtrace/contrib/integration_registry/mappings.py b/ddtrace/contrib/integration_registry/mappings.py index f079c5f25b8..d8e77b56e9f 100644 --- a/ddtrace/contrib/integration_registry/mappings.py +++ b/ddtrace/contrib/integration_registry/mappings.py @@ -4,7 +4,6 @@ EXCLUDED_FROM_TESTING = { "coverage", - "pytest_benchmark", "asgi", "wsgi", "boto", diff --git a/ddtrace/contrib/integration_registry/registry.yaml b/ddtrace/contrib/integration_registry/registry.yaml index a2b9c616b2a..fc1d8ab88f9 100644 --- a/ddtrace/contrib/integration_registry/registry.yaml +++ b/ddtrace/contrib/integration_registry/registry.yaml @@ -783,12 +783,6 @@ integrations: min: 4.1.0 max: 6.0.1 -- integration_name: pytest_benchmark - is_external_package: true - is_tested: false - dependency_names: - - pytest_benchmark - - integration_name: ray is_external_package: true is_tested: false diff --git a/ddtrace/contrib/internal/pytest/_benchmark_utils.py b/ddtrace/contrib/internal/pytest/_benchmark_utils.py index 70a79c60700..64d8065b857 100644 --- a/ddtrace/contrib/internal/pytest/_benchmark_utils.py +++ b/ddtrace/contrib/internal/pytest/_benchmark_utils.py @@ -1,7 +1,7 @@ import pytest from ddtrace.contrib.internal.pytest._utils import _get_test_id_from_item -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_METRICS_V2 +from ddtrace.contrib.internal.pytest.benchmark_constants import PLUGIN_METRICS_V2 from ddtrace.internal.logger import get_logger from ddtrace.internal.test_visibility._benchmark_mixin import BenchmarkDurationData from ddtrace.internal.test_visibility.api import InternalTest diff --git a/ddtrace/contrib/internal/pytest_benchmark/constants.py b/ddtrace/contrib/internal/pytest/benchmark_constants.py similarity index 100% rename from ddtrace/contrib/internal/pytest_benchmark/constants.py rename to ddtrace/contrib/internal/pytest/benchmark_constants.py diff --git a/ddtrace/contrib/internal/pytest_benchmark/__init__.py b/ddtrace/contrib/internal/pytest_benchmark/__init__.py deleted file mode 100644 index 6f7df090942..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -The pytest-benchmark integration traces executions of pytest benchmarks. -""" diff --git a/ddtrace/contrib/internal/pytest_benchmark/_plugin.py b/ddtrace/contrib/internal/pytest_benchmark/_plugin.py deleted file mode 100644 index 2b08969ac21..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/_plugin.py +++ /dev/null @@ -1,28 +0,0 @@ -import pytest - -from ddtrace.contrib.internal.pytest._utils import _extract_span -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_METRICS -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_OUTLIERS -from ddtrace.ext.test import TEST_TYPE - - -class _PytestBenchmarkPlugin: - @pytest.hookimpl() - def pytest_runtest_makereport(self, item, call): - fixture = hasattr(item, "funcargs") and item.funcargs.get("benchmark") - if fixture and fixture.stats: - stat_object = fixture.stats.stats - span = _extract_span(item) - - if span is None: - return - - span._set_tag_str(TEST_TYPE, "benchmark") - span._set_tag_str(BENCHMARK_INFO, "Time") - for span_path, tag in PLUGIN_METRICS.items(): - if hasattr(stat_object, tag): - if tag == PLUGIN_OUTLIERS: - span._set_tag_str(span_path, getattr(stat_object, tag)) - continue - span.set_tag(span_path, getattr(stat_object, tag)) diff --git a/ddtrace/contrib/internal/pytest_benchmark/plugin.py b/ddtrace/contrib/internal/pytest_benchmark/plugin.py deleted file mode 100644 index 7144bbd8a6f..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/plugin.py +++ /dev/null @@ -1,14 +0,0 @@ -from ddtrace import DDTraceDeprecationWarning -from ddtrace.contrib.internal.pytest.plugin import is_enabled as is_ddtrace_enabled -from ddtrace.vendor.debtcollector import deprecate - - -def pytest_configure(config): - if config.pluginmanager.hasplugin("benchmark") and config.pluginmanager.hasplugin("ddtrace"): - if is_ddtrace_enabled(config): - deprecate( - "this version of the ddtrace.pytest_benchmark plugin is deprecated", - message="it will be integrated with the main pytest ddtrace plugin", - removal_version="3.0.0", - category=DDTraceDeprecationWarning, - ) diff --git a/ddtrace/internal/ci_visibility/api/_test.py b/ddtrace/internal/ci_visibility/api/_test.py index 6ab5dd86c49..1366301a91c 100644 --- a/ddtrace/internal/ci_visibility/api/_test.py +++ b/ddtrace/internal/ci_visibility/api/_test.py @@ -9,7 +9,7 @@ import ddtrace from ddtrace._trace.context import Context -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_INFO from ddtrace.ext import SpanTypes from ddtrace.ext import test from ddtrace.ext.test_visibility import ITR_SKIPPING_LEVEL diff --git a/pyproject.toml b/pyproject.toml index a3c77ff75ea..79406685b07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,6 @@ ddcontextvars_context = "ddtrace.internal.opentelemetry.context:DDRuntimeContext [project.entry-points.pytest11] ddtrace = "ddtrace.contrib.internal.pytest.plugin" "ddtrace.pytest_bdd" = "ddtrace.contrib.internal.pytest_bdd.plugin" -"ddtrace.pytest_benchmark" = "ddtrace.contrib.internal.pytest_benchmark.plugin" [project.entry-points.'ddtrace.products'] "apm-tracing-rc" = "ddtrace.internal.remoteconfig.products.apm_tracing" diff --git a/tests/ci_visibility/suitespec.yml b/tests/ci_visibility/suitespec.yml index 99b565bcd10..60f87fb517d 100644 --- a/tests/ci_visibility/suitespec.yml +++ b/tests/ci_visibility/suitespec.yml @@ -57,7 +57,6 @@ suites: - '@codeowners' - '@freezegun' - tests/contrib/pytest/* - - tests/contrib/pytest_benchmark/* - tests/contrib/pytest_bdd/* - tests/contrib/pytest_flaky/* - tests/snapshots/tests.contrib.pytest.* diff --git a/tests/contrib/pytest_benchmark/test_pytest_benchmark.py b/tests/contrib/pytest/test_pytest_benchmark.py similarity index 82% rename from tests/contrib/pytest_benchmark/test_pytest_benchmark.py rename to tests/contrib/pytest/test_pytest_benchmark.py index 233a389855c..2cee9b7b438 100644 --- a/tests/contrib/pytest_benchmark/test_pytest_benchmark.py +++ b/tests/contrib/pytest/test_pytest_benchmark.py @@ -1,24 +1,24 @@ import os -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_MEAN -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_RUN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_HD15IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_IQR_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_LD15IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MAX -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MEAN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MEDIAN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MIN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_N -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_OPS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_Q1 -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_Q3 -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_STDDEV -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_STDDEV_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_TOTAL +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_INFO +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_MEAN +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_RUN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_HD15IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_IQR_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_LD15IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MAX +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MEAN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MEDIAN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MIN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_N +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_OPS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_Q1 +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_Q3 +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_STDDEV +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_STDDEV_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_TOTAL from ddtrace.ext.test import TEST_TYPE from tests.contrib.pytest.test_pytest import PytestTestCaseBase diff --git a/tests/contrib/pytest_benchmark/__init__.py b/tests/contrib/pytest_benchmark/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000