From 7f077a5e92b51438e6bbb1cbd5e6895b0e9b8a9d Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Tue, 24 Dec 2024 16:25:28 -0500 Subject: [PATCH 01/11] chore: rename deprecated imports --- ddtrace/_trace/tracer.py | 4 +- tests/appsec/iast/conftest.py | 16 ++++---- tests/appsec/iast/taint_sinks/test_ssrf.py | 20 +++++----- tests/appsec/iast/test_telemetry.py | 4 +- tests/contrib/aiobotocore/test.py | 8 ++-- .../aiobotocore/test_aiobotocore_patch.py | 6 +-- tests/contrib/aiohttp/conftest.py | 2 +- tests/contrib/aiohttp/test_aiohttp_client.py | 6 +-- tests/contrib/aiohttp/test_aiohttp_patch.py | 6 +-- tests/contrib/aiohttp_jinja2/conftest.py | 4 +- .../test_aiohttp_jinja2_patch.py | 6 +-- tests/contrib/aiomysql/test_aiomysql.py | 4 +- tests/contrib/aiomysql/test_aiomysql_patch.py | 6 +-- tests/contrib/aiopg/test.py | 4 +- tests/contrib/aiopg/test_aiopg_patch.py | 6 +-- tests/contrib/algoliasearch/test.py | 6 +-- .../algoliasearch/test_algoliasearch_patch.py | 6 +-- tests/contrib/anthropic/conftest.py | 4 +- .../contrib/anthropic/test_anthropic_patch.py | 6 +-- tests/contrib/aredis/test_aredis.py | 4 +- tests/contrib/aredis/test_aredis_patch.py | 6 +-- tests/contrib/asgi/test_asgi.py | 12 +++--- tests/contrib/asyncio/test_propagation.py | 4 +- tests/contrib/asyncio/test_tracer.py | 4 +- tests/contrib/asyncpg/test_asyncpg.py | 4 +- tests/contrib/asyncpg/test_asyncpg_patch.py | 6 +-- tests/contrib/aws_lambda/test_aws_lambda.py | 4 +- .../test_azure_functions_patch.py | 6 +-- tests/contrib/boto/test.py | 4 +- tests/contrib/boto/test_boto_patch.py | 6 +-- tests/contrib/botocore/test.py | 6 +-- tests/contrib/botocore/test_bedrock_llmobs.py | 4 +- tests/contrib/botocore/test_botocore_patch.py | 6 +-- tests/contrib/bottle/test.py | 2 +- tests/contrib/bottle/test_bottle_patch.py | 6 +-- tests/contrib/cassandra/test.py | 4 +- .../contrib/cassandra/test_cassandra_patch.py | 6 +-- tests/contrib/celery/base.py | 4 +- tests/contrib/celery/test_app.py | 2 +- tests/contrib/celery/test_integration.py | 4 +- tests/contrib/celery/test_patch.py | 6 +-- tests/contrib/celery/test_tagging.py | 4 +- tests/contrib/cherrypy/test_middleware.py | 8 ++-- tests/contrib/consul/test.py | 4 +- tests/contrib/consul/test_consul_patch.py | 6 +-- tests/contrib/django/asgi.py | 2 +- tests/contrib/django/conftest.py | 2 +- tests/contrib/django/test_django.py | 4 +- tests/contrib/django/test_django_patch.py | 4 +- tests/contrib/django/test_django_snapshots.py | 8 ++-- tests/contrib/django/test_django_wsgi.py | 2 +- tests/contrib/django_hosts/conftest.py | 2 +- tests/contrib/djangorestframework/conftest.py | 2 +- .../dogpile_cache/test_dogpile_cache_patch.py | 6 +-- tests/contrib/dogpile_cache/test_tracing.py | 4 +- tests/contrib/dramatiq/test_integration.py | 4 +- tests/contrib/dramatiq/test_patch_manual.py | 4 +- .../elasticsearch/test_elasticsearch.py | 8 ++-- tests/contrib/falcon/app/app.py | 4 +- .../falcon/test_distributed_tracing.py | 2 +- tests/contrib/falcon/test_falcon_patch.py | 6 +-- tests/contrib/falcon/test_middleware.py | 2 +- tests/contrib/falcon/test_schematization.py | 4 +- tests/contrib/falcon/test_suite.py | 2 +- tests/contrib/fastapi/conftest.py | 4 +- tests/contrib/fastapi/test_fastapi.py | 4 +- .../fastapi/test_fastapi_appsec_iast.py | 2 +- tests/contrib/fastapi/test_fastapi_patch.py | 6 +-- tests/contrib/flask/__init__.py | 4 +- .../flask/test_appsec_flask_snapshot.py | 2 +- tests/contrib/flask/test_blueprint.py | 2 +- tests/contrib/flask/test_flask_appsec.py | 2 +- tests/contrib/flask/test_flask_appsec_iast.py | 2 +- tests/contrib/flask/test_flask_helpers.py | 4 +- tests/contrib/flask/test_flask_patch.py | 6 +-- tests/contrib/flask/test_flask_snapshot.py | 2 +- tests/contrib/flask/test_hooks.py | 2 +- tests/contrib/flask/test_idempotency.py | 4 +- tests/contrib/flask/test_request.py | 2 +- tests/contrib/flask/test_signals.py | 4 +- tests/contrib/flask/test_static.py | 2 +- tests/contrib/flask/test_template.py | 4 +- .../flask_autopatch/test_flask_autopatch.py | 2 +- tests/contrib/flask_cache/test.py | 2 +- tests/contrib/flask_cache/test_utils.py | 2 +- .../flask_cache/test_wrapper_safety.py | 2 +- tests/contrib/freezegun/test_freezegun.py | 8 ++-- tests/contrib/futures/test_futures_patch.py | 6 +-- tests/contrib/futures/test_propagation.py | 4 +- tests/contrib/gevent/test_tracer.py | 4 +- tests/contrib/google_generativeai/conftest.py | 4 +- .../test_google_generativeai_patch.py | 6 +-- tests/contrib/graphene/test_graphene.py | 4 +- tests/contrib/graphql/test_graphql.py | 4 +- tests/contrib/graphql/test_graphql_patch.py | 6 +-- tests/contrib/grpc/common.py | 6 +-- tests/contrib/grpc/test_constants.py | 2 +- tests/contrib/grpc/test_grpc.py | 4 +- tests/contrib/grpc/test_grpc_patch.py | 4 +- tests/contrib/grpc_aio/test_grpc_aio.py | 8 ++-- tests/contrib/gunicorn/wsgi_mw_app.py | 2 +- tests/contrib/httplib/test_httplib.py | 6 +-- tests/contrib/httplib/test_httplib_patch.py | 6 +-- tests/contrib/httpx/test_httpx.py | 26 ++++++------ tests/contrib/httpx/test_httpx_patch.py | 6 +-- tests/contrib/httpx/test_httpx_pre_0_11.py | 28 ++++++------- tests/contrib/jinja2/test_jinja2.py | 4 +- tests/contrib/jinja2/test_jinja2_patch.py | 6 +-- tests/contrib/kafka/test_kafka.py | 14 +++---- tests/contrib/kafka/test_kafka_patch.py | 6 +-- tests/contrib/kombu/test.py | 6 +-- tests/contrib/kombu/test_kombu_patch.py | 6 +-- tests/contrib/langchain/conftest.py | 2 +- .../contrib/langchain/test_langchain_patch.py | 8 ++-- tests/contrib/logbook/test_logbook_logging.py | 16 ++++---- tests/contrib/logbook/test_logbook_patch.py | 6 +-- tests/contrib/logging/test_logging.py | 4 +- tests/contrib/logging/test_logging_patch.py | 6 +-- tests/contrib/loguru/test_loguru_logging.py | 4 +- tests/contrib/loguru/test_loguru_patch.py | 6 +-- tests/contrib/mako/test_mako.py | 4 +- tests/contrib/mako/test_mako_patch.py | 6 +-- tests/contrib/mariadb/test_mariadb.py | 4 +- tests/contrib/mariadb/test_mariadb_patch.py | 6 +-- tests/contrib/molten/test_molten.py | 6 +-- tests/contrib/molten/test_molten_di.py | 4 +- tests/contrib/molten/test_molten_patch.py | 6 +-- tests/contrib/mongoengine/test.py | 4 +- .../mongoengine/test_mongoengine_patch.py | 6 +-- tests/contrib/mysql/test_mysql.py | 4 +- tests/contrib/mysql/test_mysql_patch.py | 6 +-- tests/contrib/mysqldb/test_mysqldb.py | 4 +- tests/contrib/mysqldb/test_mysqldb_patch.py | 6 +-- tests/contrib/openai/conftest.py | 2 +- tests/contrib/openai/test_openai_patch.py | 6 +-- tests/contrib/patch.py | 26 ++++++------ tests/contrib/psycopg/test_psycopg.py | 4 +- tests/contrib/psycopg/test_psycopg_async.py | 4 +- tests/contrib/psycopg/test_psycopg_patch.py | 8 ++-- .../contrib/psycopg/test_psycopg_snapshot.py | 4 +- tests/contrib/psycopg2/test_psycopg.py | 4 +- tests/contrib/psycopg2/test_psycopg_patch.py | 8 ++-- .../contrib/psycopg2/test_psycopg_snapshot.py | 4 +- tests/contrib/pylibmc/test.py | 6 +-- tests/contrib/pylibmc/test_pylibmc_patch.py | 6 +-- tests/contrib/pymemcache/test_client.py | 4 +- .../pymemcache/test_client_defaults.py | 4 +- tests/contrib/pymemcache/test_client_mixin.py | 4 +- .../pymemcache/test_pymemcache_patch.py | 6 +-- tests/contrib/pymongo/test_pymongo_patch.py | 8 ++-- tests/contrib/pymysql/test_pymysql.py | 4 +- tests/contrib/pymysql/test_pymysql_patch.py | 6 +-- tests/contrib/pynamodb/test_pynamodb.py | 4 +- tests/contrib/pynamodb/test_pynamodb_patch.py | 6 +-- tests/contrib/pyodbc/test_pyodbc.py | 4 +- tests/contrib/pyodbc/test_pyodbc_patch.py | 6 +-- tests/contrib/pyramid/app/web.py | 2 +- tests/contrib/pyramid/test_pyramid_patch.py | 6 +-- tests/contrib/pytest/test_pytest.py | 2 +- tests/contrib/redis/test_redis.py | 4 +- tests/contrib/redis/test_redis_asyncio.py | 4 +- tests/contrib/redis/test_redis_cluster.py | 4 +- .../redis/test_redis_cluster_asyncio.py | 18 ++++----- tests/contrib/redis/test_redis_patch.py | 6 +-- tests/contrib/rediscluster/test.py | 6 +-- .../rediscluster/test_rediscluster_patch.py | 6 +-- tests/contrib/requests/test_requests.py | 6 +-- tests/contrib/requests/test_requests_patch.py | 6 +-- tests/contrib/rq/test_rq.py | 6 +-- tests/contrib/sanic/conftest.py | 4 +- tests/contrib/sanic/test_sanic_patch.py | 6 +-- .../contrib/selenium/test_selenium_chrome.py | 2 +- tests/contrib/snowflake/test_snowflake.py | 4 +- .../contrib/snowflake/test_snowflake_patch.py | 4 +- tests/contrib/sqlalchemy/mixins.py | 2 +- tests/contrib/sqlalchemy/test_patch.py | 6 +-- tests/contrib/sqlite3/test_sqlite3.py | 6 +-- tests/contrib/sqlite3/test_sqlite3_patch.py | 6 +-- tests/contrib/starlette/test_starlette.py | 8 ++-- .../contrib/starlette/test_starlette_patch.py | 6 +-- .../structlog/test_structlog_logging.py | 40 +++++++++---------- .../contrib/structlog/test_structlog_patch.py | 6 +-- tests/contrib/subprocess/test_subprocess.py | 8 ++-- .../subprocess/test_subprocess_patch.py | 6 +-- tests/contrib/tornado/test_safety.py | 4 +- tests/contrib/tornado/test_stack_context.py | 2 +- tests/contrib/tornado/test_tornado_patch.py | 6 +-- tests/contrib/tornado/utils.py | 8 ++-- tests/contrib/unittest/test_unittest.py | 4 +- tests/contrib/unittest/test_unittest_patch.py | 6 +-- tests/contrib/urllib3/test_urllib3.py | 4 +- tests/contrib/urllib3/test_urllib3_patch.py | 6 +-- tests/contrib/vertexai/conftest.py | 4 +- tests/contrib/vertexai/test_vertexai_patch.py | 6 +-- tests/contrib/vertica/test_vertica.py | 4 +- tests/contrib/vertica/test_vertica_patch.py | 6 +-- tests/contrib/wsgi/test_wsgi.py | 4 +- tests/contrib/yaaredis/test_yaaredis.py | 4 +- tests/contrib/yaaredis/test_yaaredis_patch.py | 6 +-- tests/internal/test_module.py | 2 +- tests/internal/test_serverless.py | 4 +- tests/opentracer/test_tracer_asyncio.py | 2 +- tests/opentracer/test_tracer_gevent.py | 4 +- tests/tracer/test_correlation_log_context.py | 6 +-- 204 files changed, 559 insertions(+), 559 deletions(-) diff --git a/ddtrace/_trace/tracer.py b/ddtrace/_trace/tracer.py index 6027976d6dc..327b58076c3 100644 --- a/ddtrace/_trace/tracer.py +++ b/ddtrace/_trace/tracer.py @@ -1185,11 +1185,11 @@ def _on_global_config_update(self, cfg: Config, items: List[str]) -> None: if "_logs_injection" in items: if config._logs_injection: - from ddtrace.contrib.logging import patch + from ddtrace.contrib.internal.logging.patch import patch patch() else: - from ddtrace.contrib.logging import unpatch + from ddtrace.contrib.internal.logging.patch import unpatch unpatch() diff --git a/tests/appsec/iast/conftest.py b/tests/appsec/iast/conftest.py index 3daa3611f51..b8128ae52a2 100644 --- a/tests/appsec/iast/conftest.py +++ b/tests/appsec/iast/conftest.py @@ -23,8 +23,8 @@ from ddtrace.appsec._iast.taint_sinks.weak_cipher import unpatch_iast as weak_cipher_unpatch from ddtrace.appsec._iast.taint_sinks.weak_hash import patch as weak_hash_patch from ddtrace.appsec._iast.taint_sinks.weak_hash import unpatch_iast as weak_hash_unpatch -from ddtrace.contrib.sqlite3.patch import patch as sqli_sqlite_patch -from ddtrace.contrib.sqlite3.patch import unpatch as sqli_sqlite_unpatch +from ddtrace.contrib.internal.sqlite3.patch import patch as sqli_sqlite_patch +from ddtrace.contrib.internal.sqlite3.patch import unpatch as sqli_sqlite_unpatch from tests.utils import override_env from tests.utils import override_global_config @@ -60,20 +60,20 @@ def _end_iast_context_and_oce(span=None): def iast_context(env, request_sampling=100.0, deduplication=False, asm_enabled=False): try: - from ddtrace.contrib.langchain.patch import patch as langchain_patch - from ddtrace.contrib.langchain.patch import unpatch as langchain_unpatch + from ddtrace.contrib.internal.langchain.patch import patch as langchain_patch + from ddtrace.contrib.internal.langchain.patch import unpatch as langchain_unpatch except Exception: langchain_patch = lambda: True # noqa: E731 langchain_unpatch = lambda: True # noqa: E731 try: - from ddtrace.contrib.sqlalchemy.patch import patch as sqlalchemy_patch - from ddtrace.contrib.sqlalchemy.patch import unpatch as sqlalchemy_unpatch + from ddtrace.contrib.internal.sqlalchemy.patch import patch as sqlalchemy_patch + from ddtrace.contrib.internal.sqlalchemy.patch import unpatch as sqlalchemy_unpatch except Exception: sqlalchemy_patch = lambda: True # noqa: E731 sqlalchemy_unpatch = lambda: True # noqa: E731 try: - from ddtrace.contrib.psycopg.patch import patch as psycopg_patch - from ddtrace.contrib.psycopg.patch import unpatch as psycopg_unpatch + from ddtrace.contrib.internal.psycopg.patch import patch as psycopg_patch + from ddtrace.contrib.internal.psycopg.patch import unpatch as psycopg_unpatch except Exception: psycopg_patch = lambda: True # noqa: E731 psycopg_unpatch = lambda: True # noqa: E731 diff --git a/tests/appsec/iast/taint_sinks/test_ssrf.py b/tests/appsec/iast/taint_sinks/test_ssrf.py index 8b35013b873..278d83dca93 100644 --- a/tests/appsec/iast/taint_sinks/test_ssrf.py +++ b/tests/appsec/iast/taint_sinks/test_ssrf.py @@ -2,16 +2,16 @@ from ddtrace.appsec._iast._taint_tracking import taint_pyobject from ddtrace.appsec._iast._taint_tracking.aspects import add_aspect from ddtrace.appsec._iast.constants import VULN_SSRF -from ddtrace.contrib.httplib.patch import patch as httplib_patch -from ddtrace.contrib.httplib.patch import unpatch as httplib_unpatch -from ddtrace.contrib.requests.patch import patch as requests_patch -from ddtrace.contrib.requests.patch import unpatch as requests_unpatch -from ddtrace.contrib.urllib.patch import patch as urllib_patch -from ddtrace.contrib.urllib.patch import unpatch as urllib_unpatch -from ddtrace.contrib.urllib3.patch import patch as urllib3_patch -from ddtrace.contrib.urllib3.patch import unpatch as urllib3_unpatch -from ddtrace.contrib.webbrowser.patch import patch as webbrowser_patch -from ddtrace.contrib.webbrowser.patch import unpatch as webbrowser_unpatch +from ddtrace.contrib.internal.httplib.patch import patch as httplib_patch +from ddtrace.contrib.internal.httplib.patch import unpatch as httplib_unpatch +from ddtrace.contrib.internal.requests.patch import patch as requests_patch +from ddtrace.contrib.internal.requests.patch import unpatch as requests_unpatch +from ddtrace.contrib.internal.urllib.patch import patch as urllib_patch +from ddtrace.contrib.internal.urllib.patch import unpatch as urllib_unpatch +from ddtrace.contrib.internal.urllib3.patch import patch as urllib3_patch +from ddtrace.contrib.internal.urllib3.patch import unpatch as urllib3_unpatch +from ddtrace.contrib.internal.webbrowser.patch import patch as webbrowser_patch +from ddtrace.contrib.internal.webbrowser.patch import unpatch as webbrowser_unpatch from tests.appsec.iast.conftest import _end_iast_context_and_oce from tests.appsec.iast.conftest import _start_iast_context_and_oce from tests.appsec.iast.iast_utils import get_line_and_hash diff --git a/tests/appsec/iast/test_telemetry.py b/tests/appsec/iast/test_telemetry.py index 95b9b8aeb45..dcfc5f23a3e 100644 --- a/tests/appsec/iast/test_telemetry.py +++ b/tests/appsec/iast/test_telemetry.py @@ -22,8 +22,8 @@ from ddtrace.appsec._iast.taint_sinks.command_injection import patch as cmdi_patch from ddtrace.appsec._iast.taint_sinks.header_injection import patch as header_injection_patch from ddtrace.appsec._iast.taint_sinks.header_injection import unpatch as header_injection_unpatch -from ddtrace.contrib.sqlalchemy import patch as sqli_sqlalchemy_patch -from ddtrace.contrib.sqlite3 import patch as sqli_sqlite3_patch +from ddtrace.contrib.internal.sqlalchemy.patch import patch as sqli_sqlalchemy_patch +from ddtrace.contrib.internal.sqlite3.patch import patch as sqli_sqlite3_patch from ddtrace.ext import SpanTypes from ddtrace.internal.telemetry.constants import TELEMETRY_NAMESPACE_TAG_IAST from ddtrace.internal.telemetry.constants import TELEMETRY_TYPE_GENERATE_METRICS diff --git a/tests/contrib/aiobotocore/test.py b/tests/contrib/aiobotocore/test.py index 9b31b61abb4..f535dfb76d3 100644 --- a/tests/contrib/aiobotocore/test.py +++ b/tests/contrib/aiobotocore/test.py @@ -5,8 +5,8 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.aiobotocore.patch import patch -from ddtrace.contrib.aiobotocore.patch import unpatch +from ddtrace.contrib.internal.aiobotocore.patch import patch +from ddtrace.contrib.internal.aiobotocore.patch import unpatch from tests.conftest import DEFAULT_DDTRACE_SUBPROCESS_TEST_SERVICE_NAME from tests.utils import assert_is_measured from tests.utils import assert_span_http_status_code @@ -419,8 +419,8 @@ def test_schematized_env_specified_service(ddtrace_run_python_code_in_subprocess service_name, schema_version, expected_service_name, expected_operation_name = schema_params code = """ import asyncio -from ddtrace.contrib.aiobotocore.patch import patch -from ddtrace.contrib.aiobotocore.patch import unpatch +from ddtrace.contrib.internal.aiobotocore.patch import patch +from ddtrace.contrib.internal.aiobotocore.patch import unpatch from tests.contrib.aiobotocore.utils import * from tests.conftest import * diff --git a/tests/contrib/aiobotocore/test_aiobotocore_patch.py b/tests/contrib/aiobotocore/test_aiobotocore_patch.py index 7f56b2c90f4..4a452336388 100644 --- a/tests/contrib/aiobotocore/test_aiobotocore_patch.py +++ b/tests/contrib/aiobotocore/test_aiobotocore_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aiobotocore import get_version -from ddtrace.contrib.aiobotocore.patch import patch +from ddtrace.contrib.internal.aiobotocore.patch import get_version +from ddtrace.contrib.internal.aiobotocore.patch import patch try: - from ddtrace.contrib.aiobotocore.patch import unpatch + from ddtrace.contrib.internal.aiobotocore.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aiohttp/conftest.py b/tests/contrib/aiohttp/conftest.py index cb687b20280..3855ac22e1f 100644 --- a/tests/contrib/aiohttp/conftest.py +++ b/tests/contrib/aiohttp/conftest.py @@ -2,7 +2,7 @@ import pytest from ddtrace.contrib.aiohttp.middlewares import trace_app -from ddtrace.contrib.aiohttp.patch import unpatch +from ddtrace.contrib.internal.aiohttp.patch import unpatch from ddtrace.internal.utils import version # noqa:F401 from .app.web import setup_app diff --git a/tests/contrib/aiohttp/test_aiohttp_client.py b/tests/contrib/aiohttp/test_aiohttp_client.py index dd2f51bbaa9..f490bd85ada 100644 --- a/tests/contrib/aiohttp/test_aiohttp_client.py +++ b/tests/contrib/aiohttp/test_aiohttp_client.py @@ -4,9 +4,9 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.aiohttp import patch -from ddtrace.contrib.aiohttp import unpatch -from ddtrace.contrib.aiohttp.patch import extract_netloc_and_query_info_from_url +from ddtrace.contrib.internal.aiohttp.patch import extract_netloc_and_query_info_from_url +from ddtrace.contrib.internal.aiohttp.patch import patch +from ddtrace.contrib.internal.aiohttp.patch import unpatch from tests.utils import override_config from tests.utils import override_http_config diff --git a/tests/contrib/aiohttp/test_aiohttp_patch.py b/tests/contrib/aiohttp/test_aiohttp_patch.py index e721bfc666c..e00297e8bf4 100644 --- a/tests/contrib/aiohttp/test_aiohttp_patch.py +++ b/tests/contrib/aiohttp/test_aiohttp_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aiohttp import get_version -from ddtrace.contrib.aiohttp.patch import patch +from ddtrace.contrib.internal.aiohttp.patch import get_version +from ddtrace.contrib.internal.aiohttp.patch import patch try: - from ddtrace.contrib.aiohttp.patch import unpatch + from ddtrace.contrib.internal.aiohttp.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aiohttp_jinja2/conftest.py b/tests/contrib/aiohttp_jinja2/conftest.py index aca4965c318..92c49f015f3 100644 --- a/tests/contrib/aiohttp_jinja2/conftest.py +++ b/tests/contrib/aiohttp_jinja2/conftest.py @@ -1,8 +1,8 @@ import aiohttp_jinja2 import pytest -from ddtrace.contrib.aiohttp_jinja2 import patch -from ddtrace.contrib.aiohttp_jinja2 import unpatch +from ddtrace.contrib.internal.aiohttp_jinja2.patch import patch +from ddtrace.contrib.internal.aiohttp_jinja2.patch import unpatch from ddtrace.pin import Pin from tests.contrib.aiohttp.conftest import app_tracer # noqa:F401 from tests.contrib.aiohttp.conftest import patched_app_tracer # noqa:F401 diff --git a/tests/contrib/aiohttp_jinja2/test_aiohttp_jinja2_patch.py b/tests/contrib/aiohttp_jinja2/test_aiohttp_jinja2_patch.py index e9dfc0d5e1b..c2b684418d5 100644 --- a/tests/contrib/aiohttp_jinja2/test_aiohttp_jinja2_patch.py +++ b/tests/contrib/aiohttp_jinja2/test_aiohttp_jinja2_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aiohttp_jinja2 import get_version -from ddtrace.contrib.aiohttp_jinja2.patch import patch +from ddtrace.contrib.internal.aiohttp_jinja2.patch import get_version +from ddtrace.contrib.internal.aiohttp_jinja2.patch import patch try: - from ddtrace.contrib.aiohttp_jinja2.patch import unpatch + from ddtrace.contrib.internal.aiohttp_jinja2.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aiomysql/test_aiomysql.py b/tests/contrib/aiomysql/test_aiomysql.py index ce6cfd7ce3c..9bd898c52ae 100644 --- a/tests/contrib/aiomysql/test_aiomysql.py +++ b/tests/contrib/aiomysql/test_aiomysql.py @@ -7,8 +7,8 @@ from ddtrace import Pin from ddtrace import Tracer -from ddtrace.contrib.aiomysql import patch -from ddtrace.contrib.aiomysql import unpatch +from ddtrace.contrib.internal.aiomysql.patch import patch +from ddtrace.contrib.internal.aiomysql.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib import shared_tests_async as shared_tests from tests.contrib.asyncio.utils import AsyncioTestCase diff --git a/tests/contrib/aiomysql/test_aiomysql_patch.py b/tests/contrib/aiomysql/test_aiomysql_patch.py index cbdb900d48f..29ea79357a2 100644 --- a/tests/contrib/aiomysql/test_aiomysql_patch.py +++ b/tests/contrib/aiomysql/test_aiomysql_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aiomysql import get_version -from ddtrace.contrib.aiomysql.patch import patch +from ddtrace.contrib.internal.aiomysql.patch import get_version +from ddtrace.contrib.internal.aiomysql.patch import patch try: - from ddtrace.contrib.aiomysql.patch import unpatch + from ddtrace.contrib.internal.aiomysql.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aiopg/test.py b/tests/contrib/aiopg/test.py index c2b5fc49804..da741bacca3 100644 --- a/tests/contrib/aiopg/test.py +++ b/tests/contrib/aiopg/test.py @@ -6,8 +6,8 @@ # project from ddtrace import Pin -from ddtrace.contrib.aiopg.patch import patch -from ddtrace.contrib.aiopg.patch import unpatch +from ddtrace.contrib.internal.aiopg.patch import patch +from ddtrace.contrib.internal.aiopg.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib.asyncio.utils import AsyncioTestCase from tests.contrib.config import POSTGRES_CONFIG diff --git a/tests/contrib/aiopg/test_aiopg_patch.py b/tests/contrib/aiopg/test_aiopg_patch.py index edbb57005cb..459f64cb69b 100644 --- a/tests/contrib/aiopg/test_aiopg_patch.py +++ b/tests/contrib/aiopg/test_aiopg_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aiopg import get_version -from ddtrace.contrib.aiopg.patch import patch +from ddtrace.contrib.internal.aiopg.patch import get_version +from ddtrace.contrib.internal.aiopg.patch import patch try: - from ddtrace.contrib.aiopg.patch import unpatch + from ddtrace.contrib.internal.aiopg.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/algoliasearch/test.py b/tests/contrib/algoliasearch/test.py index 3b81e195899..3d563e11035 100644 --- a/tests/contrib/algoliasearch/test.py +++ b/tests/contrib/algoliasearch/test.py @@ -1,8 +1,8 @@ from ddtrace import config from ddtrace import patch_all -from ddtrace.contrib.algoliasearch.patch import algoliasearch_version -from ddtrace.contrib.algoliasearch.patch import patch -from ddtrace.contrib.algoliasearch.patch import unpatch +from ddtrace.contrib.internal.algoliasearch.patch import algoliasearch_version +from ddtrace.contrib.internal.algoliasearch.patch import patch +from ddtrace.contrib.internal.algoliasearch.patch import unpatch from ddtrace.pin import Pin from ddtrace.vendor.packaging.version import parse as parse_version from tests.utils import TracerTestCase diff --git a/tests/contrib/algoliasearch/test_algoliasearch_patch.py b/tests/contrib/algoliasearch/test_algoliasearch_patch.py index 324e1d37f78..c8381976166 100644 --- a/tests/contrib/algoliasearch/test_algoliasearch_patch.py +++ b/tests/contrib/algoliasearch/test_algoliasearch_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.algoliasearch import get_version -from ddtrace.contrib.algoliasearch.patch import patch +from ddtrace.contrib.internal.algoliasearch.patch import get_version +from ddtrace.contrib.internal.algoliasearch.patch import patch try: - from ddtrace.contrib.algoliasearch.patch import unpatch + from ddtrace.contrib.internal.algoliasearch.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/anthropic/conftest.py b/tests/contrib/anthropic/conftest.py index 8ae466dd0bc..d975204ef7c 100644 --- a/tests/contrib/anthropic/conftest.py +++ b/tests/contrib/anthropic/conftest.py @@ -4,8 +4,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.anthropic.patch import patch -from ddtrace.contrib.anthropic.patch import unpatch +from ddtrace.contrib.internal.anthropic.patch import patch +from ddtrace.contrib.internal.anthropic.patch import unpatch from ddtrace.llmobs import LLMObs from tests.contrib.anthropic.utils import get_request_vcr from tests.utils import DummyTracer diff --git a/tests/contrib/anthropic/test_anthropic_patch.py b/tests/contrib/anthropic/test_anthropic_patch.py index 52675cc1341..3e6234393e4 100644 --- a/tests/contrib/anthropic/test_anthropic_patch.py +++ b/tests/contrib/anthropic/test_anthropic_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.anthropic import get_version -from ddtrace.contrib.anthropic import patch -from ddtrace.contrib.anthropic import unpatch +from ddtrace.contrib.internal.anthropic.patch import get_version +from ddtrace.contrib.internal.anthropic.patch import patch +from ddtrace.contrib.internal.anthropic.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aredis/test_aredis.py b/tests/contrib/aredis/test_aredis.py index 4949a3b19d0..c0e5719b80e 100644 --- a/tests/contrib/aredis/test_aredis.py +++ b/tests/contrib/aredis/test_aredis.py @@ -6,8 +6,8 @@ from wrapt import ObjectProxy from ddtrace import Pin -from ddtrace.contrib.aredis.patch import patch -from ddtrace.contrib.aredis.patch import unpatch +from ddtrace.contrib.internal.aredis.patch import patch +from ddtrace.contrib.internal.aredis.patch import unpatch from tests.conftest import DEFAULT_DDTRACE_SUBPROCESS_TEST_SERVICE_NAME from tests.opentracer.utils import init_tracer from tests.utils import override_config diff --git a/tests/contrib/aredis/test_aredis_patch.py b/tests/contrib/aredis/test_aredis_patch.py index f6d8c550883..7faf3a84e0f 100644 --- a/tests/contrib/aredis/test_aredis_patch.py +++ b/tests/contrib/aredis/test_aredis_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.aredis import get_version -from ddtrace.contrib.aredis.patch import patch +from ddtrace.contrib.internal.aredis.patch import get_version +from ddtrace.contrib.internal.aredis.patch import patch try: - from ddtrace.contrib.aredis.patch import unpatch + from ddtrace.contrib.internal.aredis.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/asgi/test_asgi.py b/tests/contrib/asgi/test_asgi.py index 40935990fc2..6cacd4600b4 100644 --- a/tests/contrib/asgi/test_asgi.py +++ b/tests/contrib/asgi/test_asgi.py @@ -8,8 +8,8 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.asgi import TraceMiddleware -from ddtrace.contrib.asgi import span_from_scope +from ddtrace.contrib.internal.asgi.middleware import TraceMiddleware +from ddtrace.contrib.internal.asgi.middleware import span_from_scope from ddtrace.propagation import http as http_propagation from tests.conftest import DEFAULT_DDTRACE_SUBPROCESS_TEST_SERVICE_NAME from tests.utils import DummyTracer @@ -193,8 +193,8 @@ def test_span_attribute_schema_operation_name(ddtrace_run_python_code_in_subproc from tests.contrib.asgi.test_asgi import scope from tests.contrib.asgi.test_asgi import tracer from asgiref.testing import ApplicationCommunicator -from ddtrace.contrib.asgi import TraceMiddleware -from ddtrace.contrib.asgi import span_from_scope +from ddtrace.contrib.internal.asgi.middleware import TraceMiddleware +from ddtrace.contrib.internal.asgi.middleware import span_from_scope @pytest.mark.asyncio @@ -252,8 +252,8 @@ def test_span_attribute_schema_service_name(ddtrace_run_python_code_in_subproces from tests.contrib.asgi.test_asgi import scope from tests.contrib.asgi.test_asgi import tracer from asgiref.testing import ApplicationCommunicator -from ddtrace.contrib.asgi import TraceMiddleware -from ddtrace.contrib.asgi import span_from_scope +from ddtrace.contrib.internal.asgi.middleware import TraceMiddleware +from ddtrace.contrib.internal.asgi.middleware import span_from_scope @pytest.mark.asyncio async def test(scope, tracer, test_spans): diff --git a/tests/contrib/asyncio/test_propagation.py b/tests/contrib/asyncio/test_propagation.py index b62f004f281..fa78e975c9f 100644 --- a/tests/contrib/asyncio/test_propagation.py +++ b/tests/contrib/asyncio/test_propagation.py @@ -5,8 +5,8 @@ from ddtrace._trace.context import Context from ddtrace._trace.provider import DefaultContextProvider -from ddtrace.contrib.asyncio.patch import patch -from ddtrace.contrib.asyncio.patch import unpatch +from ddtrace.contrib.internal.asyncio.patch import patch +from ddtrace.contrib.internal.asyncio.patch import unpatch from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/asyncio/test_tracer.py b/tests/contrib/asyncio/test_tracer.py index 16d16215b5e..e7aaa94d903 100644 --- a/tests/contrib/asyncio/test_tracer.py +++ b/tests/contrib/asyncio/test_tracer.py @@ -4,9 +4,9 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.asyncio import patch -from ddtrace.contrib.asyncio import unpatch from ddtrace.contrib.asyncio.compat import asyncio_current_task +from ddtrace.contrib.internal.asyncio.patch import patch +from ddtrace.contrib.internal.asyncio.patch import unpatch @pytest.fixture(autouse=True) diff --git a/tests/contrib/asyncpg/test_asyncpg.py b/tests/contrib/asyncpg/test_asyncpg.py index 8a43e3f68ab..539f64f10ac 100644 --- a/tests/contrib/asyncpg/test_asyncpg.py +++ b/tests/contrib/asyncpg/test_asyncpg.py @@ -7,8 +7,8 @@ from ddtrace import Pin from ddtrace import tracer -from ddtrace.contrib.asyncpg import patch -from ddtrace.contrib.asyncpg import unpatch +from ddtrace.contrib.internal.asyncpg.patch import patch +from ddtrace.contrib.internal.asyncpg.patch import unpatch from ddtrace.contrib.trace_utils import iswrapped from tests.contrib.asyncio.utils import AsyncioTestCase from tests.contrib.asyncio.utils import mark_asyncio diff --git a/tests/contrib/asyncpg/test_asyncpg_patch.py b/tests/contrib/asyncpg/test_asyncpg_patch.py index 3e9a1dcac71..23a7e69abc0 100644 --- a/tests/contrib/asyncpg/test_asyncpg_patch.py +++ b/tests/contrib/asyncpg/test_asyncpg_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.asyncpg import get_version -from ddtrace.contrib.asyncpg.patch import patch +from ddtrace.contrib.internal.asyncpg.patch import get_version +from ddtrace.contrib.internal.asyncpg.patch import patch try: - from ddtrace.contrib.asyncpg.patch import unpatch + from ddtrace.contrib.internal.asyncpg.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/aws_lambda/test_aws_lambda.py b/tests/contrib/aws_lambda/test_aws_lambda.py index 2de2b286e03..dd99607000c 100644 --- a/tests/contrib/aws_lambda/test_aws_lambda.py +++ b/tests/contrib/aws_lambda/test_aws_lambda.py @@ -1,7 +1,7 @@ import pytest -from ddtrace.contrib.aws_lambda import patch -from ddtrace.contrib.aws_lambda import unpatch +from ddtrace.contrib.internal.aws_lambda.patch import patch +from ddtrace.contrib.internal.aws_lambda.patch import unpatch from tests.contrib.aws_lambda.handlers import class_handler from tests.contrib.aws_lambda.handlers import datadog from tests.contrib.aws_lambda.handlers import finishing_spans_early_handler diff --git a/tests/contrib/azure_functions/test_azure_functions_patch.py b/tests/contrib/azure_functions/test_azure_functions_patch.py index acc58df654a..2dfa71ade15 100644 --- a/tests/contrib/azure_functions/test_azure_functions_patch.py +++ b/tests/contrib/azure_functions/test_azure_functions_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.azure_functions import get_version -from ddtrace.contrib.azure_functions.patch import patch +from ddtrace.contrib.internal.azure_functions.patch import get_version +from ddtrace.contrib.internal.azure_functions.patch import patch try: - from ddtrace.contrib.azure_functions.patch import unpatch + from ddtrace.contrib.internal.azure_functions.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/boto/test.py b/tests/contrib/boto/test.py index f0b9cb57fd1..cd2520be5b9 100644 --- a/tests/contrib/boto/test.py +++ b/tests/contrib/boto/test.py @@ -16,8 +16,8 @@ # project from ddtrace import Pin -from ddtrace.contrib.boto.patch import patch -from ddtrace.contrib.boto.patch import unpatch +from ddtrace.contrib.internal.boto.patch import patch +from ddtrace.contrib.internal.boto.patch import unpatch from ddtrace.ext import http from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/boto/test_boto_patch.py b/tests/contrib/boto/test_boto_patch.py index 4dcc92ee184..831d8eaa957 100644 --- a/tests/contrib/boto/test_boto_patch.py +++ b/tests/contrib/boto/test_boto_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.boto import get_version -from ddtrace.contrib.boto.patch import patch +from ddtrace.contrib.internal.boto.patch import get_version +from ddtrace.contrib.internal.boto.patch import patch try: - from ddtrace.contrib.boto.patch import unpatch + from ddtrace.contrib.internal.boto.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/botocore/test.py b/tests/contrib/botocore/test.py index 085dcbbc1e9..16735472f66 100644 --- a/tests/contrib/botocore/test.py +++ b/tests/contrib/botocore/test.py @@ -37,9 +37,9 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.botocore.patch import patch -from ddtrace.contrib.botocore.patch import patch_submodules -from ddtrace.contrib.botocore.patch import unpatch +from ddtrace.contrib.internal.botocore.patch import patch +from ddtrace.contrib.internal.botocore.patch import patch_submodules +from ddtrace.contrib.internal.botocore.patch import unpatch from ddtrace.internal.compat import PYTHON_VERSION_INFO from ddtrace.internal.datastreams.processor import PROPAGATION_KEY_BASE_64 from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/botocore/test_bedrock_llmobs.py b/tests/contrib/botocore/test_bedrock_llmobs.py index ced2dc37265..c4af15100f2 100644 --- a/tests/contrib/botocore/test_bedrock_llmobs.py +++ b/tests/contrib/botocore/test_bedrock_llmobs.py @@ -5,8 +5,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.botocore.patch import patch -from ddtrace.contrib.botocore.patch import unpatch +from ddtrace.contrib.internal.botocore.patch import patch +from ddtrace.contrib.internal.botocore.patch import unpatch from ddtrace.llmobs import LLMObs from tests.contrib.botocore.bedrock_utils import _MODELS from tests.contrib.botocore.bedrock_utils import _REQUEST_BODIES diff --git a/tests/contrib/botocore/test_botocore_patch.py b/tests/contrib/botocore/test_botocore_patch.py index abb24d96dc5..7c4e710b6c3 100644 --- a/tests/contrib/botocore/test_botocore_patch.py +++ b/tests/contrib/botocore/test_botocore_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.botocore import get_version -from ddtrace.contrib.botocore.patch import patch +from ddtrace.contrib.internal.botocore.patch import get_version +from ddtrace.contrib.internal.botocore.patch import patch try: - from ddtrace.contrib.botocore.patch import unpatch + from ddtrace.contrib.internal.botocore.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/bottle/test.py b/tests/contrib/bottle/test.py index 9f0323ed9a5..abe1d6cd33c 100644 --- a/tests/contrib/bottle/test.py +++ b/tests/contrib/bottle/test.py @@ -3,7 +3,7 @@ import ddtrace from ddtrace import config -from ddtrace.contrib.bottle import TracePlugin +from ddtrace.contrib.bottle.patch import TracePlugin from ddtrace.ext import http from ddtrace.internal import compat from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/bottle/test_bottle_patch.py b/tests/contrib/bottle/test_bottle_patch.py index 1b255e1da2b..c7e1c0f2ee2 100644 --- a/tests/contrib/bottle/test_bottle_patch.py +++ b/tests/contrib/bottle/test_bottle_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.bottle import get_version -from ddtrace.contrib.bottle.patch import patch +from ddtrace.contrib.internal.bottle.patch import get_version +from ddtrace.contrib.internal.bottle.patch import patch try: - from ddtrace.contrib.bottle.patch import unpatch + from ddtrace.contrib.internal.bottle.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/cassandra/test.py b/tests/contrib/cassandra/test.py index b3395a61e6e..d0fee6e12a6 100644 --- a/tests/contrib/cassandra/test.py +++ b/tests/contrib/cassandra/test.py @@ -13,9 +13,9 @@ from ddtrace import config from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.cassandra.patch import patch -from ddtrace.contrib.cassandra.patch import unpatch from ddtrace.contrib.cassandra.session import SERVICE +from ddtrace.contrib.internal.cassandra.patch import patch +from ddtrace.contrib.internal.cassandra.patch import unpatch from ddtrace.ext import cassandra as cassx from ddtrace.ext import net from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/cassandra/test_cassandra_patch.py b/tests/contrib/cassandra/test_cassandra_patch.py index b1da5f99262..31921ce1dfa 100644 --- a/tests/contrib/cassandra/test_cassandra_patch.py +++ b/tests/contrib/cassandra/test_cassandra_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.cassandra import get_version -from ddtrace.contrib.cassandra.patch import patch +from ddtrace.contrib.internal.cassandra.patch import get_version +from ddtrace.contrib.internal.cassandra.patch import patch try: - from ddtrace.contrib.cassandra.patch import unpatch + from ddtrace.contrib.internal.cassandra.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/celery/base.py b/tests/contrib/celery/base.py index 3a14f92c33f..4e89b77a94b 100644 --- a/tests/contrib/celery/base.py +++ b/tests/contrib/celery/base.py @@ -4,8 +4,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.celery import patch -from ddtrace.contrib.celery import unpatch +from ddtrace.contrib.internal.celery.patch import patch +from ddtrace.contrib.internal.celery.patch import unpatch from tests.utils import TracerTestCase from ..config import RABBITMQ_CONFIG diff --git a/tests/contrib/celery/test_app.py b/tests/contrib/celery/test_app.py index ed26f00878d..6f43a04a9bf 100644 --- a/tests/contrib/celery/test_app.py +++ b/tests/contrib/celery/test_app.py @@ -1,7 +1,7 @@ import celery from ddtrace import Pin -from ddtrace.contrib.celery import unpatch_app +from ddtrace.contrib.internal.celery.patch import unpatch_app from .base import CeleryBaseTestCase diff --git a/tests/contrib/celery/test_integration.py b/tests/contrib/celery/test_integration.py index c3696f27307..8b676fa1108 100644 --- a/tests/contrib/celery/test_integration.py +++ b/tests/contrib/celery/test_integration.py @@ -11,8 +11,8 @@ from ddtrace import Pin from ddtrace._trace.context import Context from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.celery import patch -from ddtrace.contrib.celery import unpatch +from ddtrace.contrib.internal.celery.patch import patch +from ddtrace.contrib.internal.celery.patch import unpatch import ddtrace.internal.forksafe as forksafe from ddtrace.propagation.http import HTTPPropagator from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/celery/test_patch.py b/tests/contrib/celery/test_patch.py index 28d34552551..fe0e5b97b2b 100644 --- a/tests/contrib/celery/test_patch.py +++ b/tests/contrib/celery/test_patch.py @@ -9,7 +9,7 @@ def test_patch_after_import(self): import celery from ddtrace import patch - from ddtrace.contrib.celery import unpatch + from ddtrace.contrib.internal.celery.patch import unpatch patch(celery=True) @@ -19,7 +19,7 @@ def test_patch_after_import(self): def test_patch_before_import(self): from ddtrace import patch - from ddtrace.contrib.celery import unpatch + from ddtrace.contrib.internal.celery.patch import unpatch patch(celery=True) import celery @@ -29,7 +29,7 @@ def test_patch_before_import(self): unpatch() def test_and_emit_get_version(self): - from ddtrace.contrib.celery import get_version + from ddtrace.contrib.internal.celery.patch import get_version version = get_version() assert type(version) == str diff --git a/tests/contrib/celery/test_tagging.py b/tests/contrib/celery/test_tagging.py index 2809364ba13..22e8b539c50 100644 --- a/tests/contrib/celery/test_tagging.py +++ b/tests/contrib/celery/test_tagging.py @@ -6,8 +6,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.celery import patch -from ddtrace.contrib.celery import unpatch +from ddtrace.contrib.internal.celery.patch import patch +from ddtrace.contrib.internal.celery.patch import unpatch from tests.utils import DummyTracer from .base import AMQP_BROKER_URL diff --git a/tests/contrib/cherrypy/test_middleware.py b/tests/contrib/cherrypy/test_middleware.py index 0a524120de9..9aa03aa94ff 100644 --- a/tests/contrib/cherrypy/test_middleware.py +++ b/tests/contrib/cherrypy/test_middleware.py @@ -15,7 +15,7 @@ from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE from ddtrace.constants import SAMPLING_PRIORITY_KEY -from ddtrace.contrib.cherrypy import TraceMiddleware +from ddtrace.contrib.cherrypy.middleware import TraceMiddleware from ddtrace.ext import http from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import TracerTestCase @@ -55,7 +55,7 @@ def setUp(self): ) def test_and_emit_get_version(self): - from ddtrace.contrib.cherrypy import get_version + from ddtrace.contrib.internal.cherrypy.patch import get_version version = get_version() assert type(version) == str @@ -543,7 +543,7 @@ def test_service_name_schema(ddtrace_run_python_code_in_subprocess, schema_versi from cherrypy.test import helper from tests.utils import TracerTestCase from tests.contrib.cherrypy.web import StubApp -from ddtrace.contrib.cherrypy import TraceMiddleware +from ddtrace.contrib.internal.cherrypy.middleware import TraceMiddleware class TestCherrypy(TracerTestCase, helper.CPWebCase): @staticmethod def setup_server(): @@ -602,7 +602,7 @@ def test_operation_name_schema(ddtrace_run_python_code_in_subprocess, schema_ver from cherrypy.test import helper from tests.utils import TracerTestCase from tests.contrib.cherrypy.web import StubApp -from ddtrace.contrib.cherrypy import TraceMiddleware +from ddtrace.contrib.internal.cherrypy.middleware import TraceMiddleware class TestCherrypy(TracerTestCase, helper.CPWebCase): @staticmethod def setup_server(): diff --git a/tests/contrib/consul/test.py b/tests/contrib/consul/test.py index 3abcbeb9957..c5eec48369d 100644 --- a/tests/contrib/consul/test.py +++ b/tests/contrib/consul/test.py @@ -2,8 +2,8 @@ from wrapt import BoundFunctionWrapper from ddtrace import Pin -from ddtrace.contrib.consul.patch import patch -from ddtrace.contrib.consul.patch import unpatch +from ddtrace.contrib.internal.consul.patch import patch +from ddtrace.contrib.internal.consul.patch import unpatch from ddtrace.ext import consul as consulx from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import TracerTestCase diff --git a/tests/contrib/consul/test_consul_patch.py b/tests/contrib/consul/test_consul_patch.py index 3ba449356e8..6435e95ed4c 100644 --- a/tests/contrib/consul/test_consul_patch.py +++ b/tests/contrib/consul/test_consul_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.consul import get_version -from ddtrace.contrib.consul.patch import patch +from ddtrace.contrib.internal.consul.patch import get_version +from ddtrace.contrib.internal.consul.patch import patch try: - from ddtrace.contrib.consul.patch import unpatch + from ddtrace.contrib.internal.consul.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/django/asgi.py b/tests/contrib/django/asgi.py index 96627e7e34c..602246bacab 100644 --- a/tests/contrib/django/asgi.py +++ b/tests/contrib/django/asgi.py @@ -4,7 +4,7 @@ from django.core.asgi import get_asgi_application from django.urls import re_path -from ddtrace.contrib.asgi import TraceMiddleware +from ddtrace.contrib.internal.asgi.middleware import TraceMiddleware application = get_asgi_application() diff --git a/tests/contrib/django/conftest.py b/tests/contrib/django/conftest.py index 63190d7d566..a2de59753fb 100644 --- a/tests/contrib/django/conftest.py +++ b/tests/contrib/django/conftest.py @@ -5,7 +5,7 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.django import patch +from ddtrace.contrib.internal.django.patch import patch from tests.utils import DummyTracer from tests.utils import TracerSpanContainer diff --git a/tests/contrib/django/test_django.py b/tests/contrib/django/test_django.py index cf44ed6bcdd..794a7047f45 100644 --- a/tests/contrib/django/test_django.py +++ b/tests/contrib/django/test_django.py @@ -24,9 +24,9 @@ from ddtrace.constants import SAMPLING_PRIORITY_KEY from ddtrace.constants import USER_KEEP from ddtrace.contrib import trace_utils -from ddtrace.contrib.django.patch import instrument_view -from ddtrace.contrib.django.patch import traced_get_response from ddtrace.contrib.django.utils import get_request_uri +from ddtrace.contrib.internal.django.patch import instrument_view +from ddtrace.contrib.internal.django.patch import traced_get_response from ddtrace.ext import http from ddtrace.ext import user from ddtrace.internal.compat import ensure_text diff --git a/tests/contrib/django/test_django_patch.py b/tests/contrib/django/test_django_patch.py index cec30ac004f..41e1de6b3e7 100644 --- a/tests/contrib/django/test_django_patch.py +++ b/tests/contrib/django/test_django_patch.py @@ -1,5 +1,5 @@ -from ddtrace.contrib.django import get_version -from ddtrace.contrib.django import patch +from ddtrace.contrib.internal.django.patch import get_version +from ddtrace.contrib.internal.django.patch import patch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/django/test_django_snapshots.py b/tests/contrib/django/test_django_snapshots.py index d7402e37083..547095c01f9 100644 --- a/tests/contrib/django/test_django_snapshots.py +++ b/tests/contrib/django/test_django_snapshots.py @@ -156,8 +156,8 @@ def test_404_exceptions(client): def psycopg2_patched(transactional_db): from django.db import connections - from ddtrace.contrib.psycopg.patch import patch - from ddtrace.contrib.psycopg.patch import unpatch + from ddtrace.contrib.internal.psycopg.patch import patch + from ddtrace.contrib.internal.psycopg.patch import unpatch patch() @@ -204,8 +204,8 @@ def psycopg3_patched(transactional_db): else: from django.db import connections - from ddtrace.contrib.psycopg.patch import patch - from ddtrace.contrib.psycopg.patch import unpatch + from ddtrace.contrib.internal.psycopg.patch import patch + from ddtrace.contrib.internal.psycopg.patch import unpatch patch() diff --git a/tests/contrib/django/test_django_wsgi.py b/tests/contrib/django/test_django_wsgi.py index edc065377d8..1891e5cea0e 100644 --- a/tests/contrib/django/test_django_wsgi.py +++ b/tests/contrib/django/test_django_wsgi.py @@ -10,7 +10,7 @@ from django.urls import path import pytest -from ddtrace.contrib.wsgi import DDWSGIMiddleware +from ddtrace.contrib.internal.wsgi.wsgi import DDWSGIMiddleware from ddtrace.internal.compat import PYTHON_VERSION_INFO from tests.contrib.django.utils import make_soap_request from tests.webclient import Client diff --git a/tests/contrib/django_hosts/conftest.py b/tests/contrib/django_hosts/conftest.py index 9406a29a66e..a4b18a51b67 100644 --- a/tests/contrib/django_hosts/conftest.py +++ b/tests/contrib/django_hosts/conftest.py @@ -3,7 +3,7 @@ import django from django.conf import settings -from ddtrace.contrib.django import patch +from ddtrace.contrib.internal.django.patch import patch # We manually designate which settings we will be using in an environment variable diff --git a/tests/contrib/djangorestframework/conftest.py b/tests/contrib/djangorestframework/conftest.py index efffd1b090a..1b2cc1ab4ad 100644 --- a/tests/contrib/djangorestframework/conftest.py +++ b/tests/contrib/djangorestframework/conftest.py @@ -5,7 +5,7 @@ import django from django.conf import settings -from ddtrace.contrib.django import patch +from ddtrace.contrib.internal.django.patch import patch from ..django.conftest import test_spans from ..django.conftest import tracer diff --git a/tests/contrib/dogpile_cache/test_dogpile_cache_patch.py b/tests/contrib/dogpile_cache/test_dogpile_cache_patch.py index 9c4de2a1985..0cb74993254 100644 --- a/tests/contrib/dogpile_cache/test_dogpile_cache_patch.py +++ b/tests/contrib/dogpile_cache/test_dogpile_cache_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.dogpile_cache import get_version -from ddtrace.contrib.dogpile_cache.patch import patch +from ddtrace.contrib.internal.dogpile_cache.patch import get_version +from ddtrace.contrib.internal.dogpile_cache.patch import patch try: - from ddtrace.contrib.dogpile_cache.patch import unpatch + from ddtrace.contrib.internal.dogpile_cache.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/dogpile_cache/test_tracing.py b/tests/contrib/dogpile_cache/test_tracing.py index fbf10ab4a83..d6b26bb1b58 100644 --- a/tests/contrib/dogpile_cache/test_tracing.py +++ b/tests/contrib/dogpile_cache/test_tracing.py @@ -4,8 +4,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.dogpile_cache.patch import patch -from ddtrace.contrib.dogpile_cache.patch import unpatch +from ddtrace.contrib.internal.dogpile_cache.patch import patch +from ddtrace.contrib.internal.dogpile_cache.patch import unpatch from tests.conftest import DEFAULT_DDTRACE_SUBPROCESS_TEST_SERVICE_NAME from tests.utils import DummyTracer from tests.utils import TracerSpanContainer diff --git a/tests/contrib/dramatiq/test_integration.py b/tests/contrib/dramatiq/test_integration.py index 2897cc7edcf..7d80d554390 100644 --- a/tests/contrib/dramatiq/test_integration.py +++ b/tests/contrib/dramatiq/test_integration.py @@ -3,8 +3,8 @@ import dramatiq import pytest -from ddtrace.contrib.dramatiq import patch -from ddtrace.contrib.dramatiq import unpatch +from ddtrace.contrib.internal.dramatiq.patch import patch +from ddtrace.contrib.internal.dramatiq.patch import unpatch from ddtrace.pin import Pin from tests.utils import DummyTracer from tests.utils import snapshot diff --git a/tests/contrib/dramatiq/test_patch_manual.py b/tests/contrib/dramatiq/test_patch_manual.py index d7e8619c390..67bbbe9e7ee 100644 --- a/tests/contrib/dramatiq/test_patch_manual.py +++ b/tests/contrib/dramatiq/test_patch_manual.py @@ -6,7 +6,7 @@ class DramatiqPatchTest(unittest.TestCase): def test_patch_before_import(self): from ddtrace import patch - from ddtrace.contrib.dramatiq import unpatch + from ddtrace.contrib.internal.dramatiq.patch import unpatch # Patch dramatiq before dramatiq imports patch(dramatiq=True) @@ -36,7 +36,7 @@ def test_patch_after_import(self): from dramatiq.brokers.stub import StubBroker from ddtrace import patch - from ddtrace.contrib.dramatiq import unpatch + from ddtrace.contrib.internal.dramatiq.patch import unpatch # Patch after all dramatiq imports patch(dramatiq=True) diff --git a/tests/contrib/elasticsearch/test_elasticsearch.py b/tests/contrib/elasticsearch/test_elasticsearch.py index b80b4486e71..7ac7bdce177 100644 --- a/tests/contrib/elasticsearch/test_elasticsearch.py +++ b/tests/contrib/elasticsearch/test_elasticsearch.py @@ -7,10 +7,10 @@ from ddtrace import Pin from ddtrace import config -from ddtrace.contrib.elasticsearch.patch import get_version -from ddtrace.contrib.elasticsearch.patch import get_versions -from ddtrace.contrib.elasticsearch.patch import patch -from ddtrace.contrib.elasticsearch.patch import unpatch +from ddtrace.contrib.internal.elasticsearch.patch import get_version +from ddtrace.contrib.internal.elasticsearch.patch import get_versions +from ddtrace.contrib.internal.elasticsearch.patch import patch +from ddtrace.contrib.internal.elasticsearch.patch import unpatch from ddtrace.ext import http from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib.patch import emit_integration_and_version_to_test_agent diff --git a/tests/contrib/falcon/app/app.py b/tests/contrib/falcon/app/app.py index a89de18fbfd..d3f17900485 100644 --- a/tests/contrib/falcon/app/app.py +++ b/tests/contrib/falcon/app/app.py @@ -1,7 +1,7 @@ import falcon -from ddtrace.contrib.falcon import TraceMiddleware -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.middleware import TraceMiddleware +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from . import resources diff --git a/tests/contrib/falcon/test_distributed_tracing.py b/tests/contrib/falcon/test_distributed_tracing.py index c789118ccce..c9c545430aa 100644 --- a/tests/contrib/falcon/test_distributed_tracing.py +++ b/tests/contrib/falcon/test_distributed_tracing.py @@ -1,7 +1,7 @@ from falcon import testing from ddtrace import config -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from tests.utils import DummyTracer from tests.utils import TracerTestCase diff --git a/tests/contrib/falcon/test_falcon_patch.py b/tests/contrib/falcon/test_falcon_patch.py index 013c5abc333..b6ddfa80a4d 100644 --- a/tests/contrib/falcon/test_falcon_patch.py +++ b/tests/contrib/falcon/test_falcon_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.falcon import get_version -from ddtrace.contrib.falcon.patch import patch +from ddtrace.contrib.internal.falcon.patch import get_version +from ddtrace.contrib.internal.falcon.patch import patch try: - from ddtrace.contrib.falcon.patch import unpatch + from ddtrace.contrib.internal.falcon.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/falcon/test_middleware.py b/tests/contrib/falcon/test_middleware.py index b4153994924..466e3cdd2db 100644 --- a/tests/contrib/falcon/test_middleware.py +++ b/tests/contrib/falcon/test_middleware.py @@ -1,6 +1,6 @@ from falcon import testing -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from tests.utils import TracerTestCase from .app import get_app diff --git a/tests/contrib/falcon/test_schematization.py b/tests/contrib/falcon/test_schematization.py index 5cfd4e71d2e..438433b5dac 100644 --- a/tests/contrib/falcon/test_schematization.py +++ b/tests/contrib/falcon/test_schematization.py @@ -16,7 +16,7 @@ def test_schematized_service_name(ddtrace_run_python_code_in_subprocess, schema_ import sys from falcon import testing -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from tests.contrib.falcon.test_suite import FalconTestMixin from tests.utils import TracerTestCase @@ -64,7 +64,7 @@ def test_schematized_operation_name(ddtrace_run_python_code_in_subprocess, schem import sys from falcon import testing -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from tests.contrib.falcon.test_suite import FalconTestMixin from tests.utils import TracerTestCase diff --git a/tests/contrib/falcon/test_suite.py b/tests/contrib/falcon/test_suite.py index ecec0b09a1e..cdf26d401ac 100644 --- a/tests/contrib/falcon/test_suite.py +++ b/tests/contrib/falcon/test_suite.py @@ -1,6 +1,6 @@ from ddtrace import config from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.falcon.patch import FALCON_VERSION +from ddtrace.contrib.internal.falcon.patch import FALCON_VERSION from ddtrace.ext import http as httpx from tests.opentracer.utils import init_tracer from tests.utils import assert_is_measured diff --git a/tests/contrib/fastapi/conftest.py b/tests/contrib/fastapi/conftest.py index 821ef269414..e47a6a3208c 100644 --- a/tests/contrib/fastapi/conftest.py +++ b/tests/contrib/fastapi/conftest.py @@ -2,8 +2,8 @@ import pytest import ddtrace -from ddtrace.contrib.fastapi import patch as fastapi_patch -from ddtrace.contrib.fastapi import unpatch as fastapi_unpatch +from ddtrace.contrib.internal.fastapi.patch import patch as fastapi_patch +from ddtrace.contrib.internal.fastapi.patch import unpatch as fastapi_unpatch from tests.utils import DummyTracer from tests.utils import TracerSpanContainer diff --git a/tests/contrib/fastapi/test_fastapi.py b/tests/contrib/fastapi/test_fastapi.py index f4adc720f8b..7619a35f043 100644 --- a/tests/contrib/fastapi/test_fastapi.py +++ b/tests/contrib/fastapi/test_fastapi.py @@ -6,8 +6,8 @@ import httpx import pytest -from ddtrace.contrib.starlette.patch import patch as patch_starlette -from ddtrace.contrib.starlette.patch import unpatch as unpatch_starlette +from ddtrace.contrib.internal.starlette.patch import patch as patch_starlette +from ddtrace.contrib.internal.starlette.patch import unpatch as unpatch_starlette from ddtrace.internal.utils.version import parse_version from ddtrace.propagation import http as http_propagation from tests.conftest import DEFAULT_DDTRACE_SUBPROCESS_TEST_SERVICE_NAME diff --git a/tests/contrib/fastapi/test_fastapi_appsec_iast.py b/tests/contrib/fastapi/test_fastapi_appsec_iast.py index 7f1a140ffc2..c9220502b11 100644 --- a/tests/contrib/fastapi/test_fastapi_appsec_iast.py +++ b/tests/contrib/fastapi/test_fastapi_appsec_iast.py @@ -22,7 +22,7 @@ from ddtrace.appsec._iast.constants import VULN_NO_SAMESITE_COOKIE from ddtrace.appsec._iast.constants import VULN_SQL_INJECTION from ddtrace.contrib.internal.fastapi.patch import patch as patch_fastapi -from ddtrace.contrib.sqlite3.patch import patch as patch_sqlite_sqli +from ddtrace.contrib.internal.sqlite3.patch import patch as patch_sqlite_sqli from tests.appsec.iast.iast_utils import get_line_and_hash from tests.utils import override_env from tests.utils import override_global_config diff --git a/tests/contrib/fastapi/test_fastapi_patch.py b/tests/contrib/fastapi/test_fastapi_patch.py index 62cf0ab589e..77ba91a755f 100644 --- a/tests/contrib/fastapi/test_fastapi_patch.py +++ b/tests/contrib/fastapi/test_fastapi_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.fastapi import get_version -from ddtrace.contrib.fastapi import patch -from ddtrace.contrib.fastapi import unpatch +from ddtrace.contrib.internal.fastapi.patch import get_version +from ddtrace.contrib.internal.fastapi.patch import patch +from ddtrace.contrib.internal.fastapi.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/flask/__init__.py b/tests/contrib/flask/__init__.py index bbec059ec0f..216b3676e93 100644 --- a/tests/contrib/flask/__init__.py +++ b/tests/contrib/flask/__init__.py @@ -3,8 +3,8 @@ import wrapt from ddtrace import Pin -from ddtrace.contrib.flask import patch -from ddtrace.contrib.flask import unpatch +from ddtrace.contrib.internal.flask.patch import patch +from ddtrace.contrib.internal.flask.patch import unpatch from tests.utils import TracerTestCase diff --git a/tests/contrib/flask/test_appsec_flask_snapshot.py b/tests/contrib/flask/test_appsec_flask_snapshot.py index 29629c69834..47465883395 100644 --- a/tests/contrib/flask/test_appsec_flask_snapshot.py +++ b/tests/contrib/flask/test_appsec_flask_snapshot.py @@ -11,7 +11,7 @@ import pytest from ddtrace.appsec._constants import APPSEC -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.internal.constants import BLOCKED_RESPONSE_HTML from ddtrace.internal.constants import BLOCKED_RESPONSE_JSON from ddtrace.internal.utils.retry import RetryError diff --git a/tests/contrib/flask/test_blueprint.py b/tests/contrib/flask/test_blueprint.py index 93b6c2d7ffc..db069d1bf04 100644 --- a/tests/contrib/flask/test_blueprint.py +++ b/tests/contrib/flask/test_blueprint.py @@ -1,7 +1,7 @@ import flask from ddtrace import Pin -from ddtrace.contrib.flask import unpatch +from ddtrace.contrib.internal.flask.patch import unpatch from . import BaseFlaskTestCase diff --git a/tests/contrib/flask/test_flask_appsec.py b/tests/contrib/flask/test_flask_appsec.py index 82433e63b64..bf797385f4b 100644 --- a/tests/contrib/flask/test_flask_appsec.py +++ b/tests/contrib/flask/test_flask_appsec.py @@ -2,7 +2,7 @@ from ddtrace.appsec._constants import SPAN_DATA_NAMES from ddtrace.appsec._trace_utils import block_request_if_user_blocked -from ddtrace.contrib.sqlite3.patch import patch +from ddtrace.contrib.internal.sqlite3.patch import patch from ddtrace.ext import http from ddtrace.internal import constants import tests.appsec.rules as rules diff --git a/tests/contrib/flask/test_flask_appsec_iast.py b/tests/contrib/flask/test_flask_appsec_iast.py index f1bed61cb9d..e43f98b800f 100644 --- a/tests/contrib/flask/test_flask_appsec_iast.py +++ b/tests/contrib/flask/test_flask_appsec_iast.py @@ -16,7 +16,7 @@ from ddtrace.appsec._iast.constants import VULN_NO_SAMESITE_COOKIE from ddtrace.appsec._iast.constants import VULN_SQL_INJECTION from ddtrace.appsec._iast.taint_sinks.header_injection import patch as patch_header_injection -from ddtrace.contrib.sqlite3.patch import patch as patch_sqlite_sqli +from ddtrace.contrib.internal.sqlite3.patch import patch as patch_sqlite_sqli from tests.appsec.iast.iast_utils import get_line_and_hash from tests.contrib.flask import BaseFlaskTestCase from tests.utils import override_env diff --git a/tests/contrib/flask/test_flask_helpers.py b/tests/contrib/flask/test_flask_helpers.py index 73f6fb1bf98..a02f25eb4af 100644 --- a/tests/contrib/flask/test_flask_helpers.py +++ b/tests/contrib/flask/test_flask_helpers.py @@ -3,8 +3,8 @@ import flask from ddtrace import Pin -from ddtrace.contrib.flask import unpatch -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import unpatch from ddtrace.internal.compat import StringIO from . import BaseFlaskTestCase diff --git a/tests/contrib/flask/test_flask_patch.py b/tests/contrib/flask/test_flask_patch.py index af738988991..7495caed35f 100644 --- a/tests/contrib/flask/test_flask_patch.py +++ b/tests/contrib/flask/test_flask_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.flask import get_version -from ddtrace.contrib.flask.patch import patch +from ddtrace.contrib.internal.flask.patch import get_version +from ddtrace.contrib.internal.flask.patch import patch try: - from ddtrace.contrib.flask.patch import unpatch + from ddtrace.contrib.internal.flask.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/flask/test_flask_snapshot.py b/tests/contrib/flask/test_flask_snapshot.py index e75e2e81bdb..d51014b9538 100644 --- a/tests/contrib/flask/test_flask_snapshot.py +++ b/tests/contrib/flask/test_flask_snapshot.py @@ -9,7 +9,7 @@ import pytest -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.internal.utils.retry import RetryError from tests.utils import flaky from tests.webclient import Client diff --git a/tests/contrib/flask/test_hooks.py b/tests/contrib/flask/test_hooks.py index cdf237f0922..9a3af9cf17c 100644 --- a/tests/contrib/flask/test_hooks.py +++ b/tests/contrib/flask/test_hooks.py @@ -1,7 +1,7 @@ from flask import Blueprint import pytest -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.ext import http from tests.contrib.flask.test_errorhandler import EXPECTED_METADATA from tests.utils import assert_span_http_status_code diff --git a/tests/contrib/flask/test_idempotency.py b/tests/contrib/flask/test_idempotency.py index 53625076d76..0b7758d24bc 100644 --- a/tests/contrib/flask/test_idempotency.py +++ b/tests/contrib/flask/test_idempotency.py @@ -4,10 +4,10 @@ import mock import wrapt -from ddtrace.contrib.flask import patch -from ddtrace.contrib.flask import unpatch from ddtrace.contrib.internal.flask.patch import _u from ddtrace.contrib.internal.flask.patch import _w +from ddtrace.contrib.internal.flask.patch import patch +from ddtrace.contrib.internal.flask.patch import unpatch class FlaskIdempotencyTestCase(unittest.TestCase): diff --git a/tests/contrib/flask/test_request.py b/tests/contrib/flask/test_request.py index 62df061a198..eec1a4c4a1c 100644 --- a/tests/contrib/flask/test_request.py +++ b/tests/contrib/flask/test_request.py @@ -12,7 +12,7 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.ext import http from ddtrace.propagation.http import HTTP_HEADER_PARENT_ID from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID diff --git a/tests/contrib/flask/test_signals.py b/tests/contrib/flask/test_signals.py index 1e8ac54e5b0..e16cf84157e 100644 --- a/tests/contrib/flask/test_signals.py +++ b/tests/contrib/flask/test_signals.py @@ -2,8 +2,8 @@ import mock from ddtrace import Pin -from ddtrace.contrib.flask import unpatch -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import unpatch from . import BaseFlaskTestCase diff --git a/tests/contrib/flask/test_static.py b/tests/contrib/flask/test_static.py index 14baf6ce0d6..3aa70426ab8 100644 --- a/tests/contrib/flask/test_static.py +++ b/tests/contrib/flask/test_static.py @@ -1,5 +1,5 @@ from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.ext import http from tests.utils import assert_span_http_status_code diff --git a/tests/contrib/flask/test_template.py b/tests/contrib/flask/test_template.py index f15c67aa207..7231548642e 100644 --- a/tests/contrib/flask/test_template.py +++ b/tests/contrib/flask/test_template.py @@ -1,8 +1,8 @@ import flask from ddtrace import Pin -from ddtrace.contrib.flask import unpatch -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import unpatch from . import BaseFlaskTestCase diff --git a/tests/contrib/flask_autopatch/test_flask_autopatch.py b/tests/contrib/flask_autopatch/test_flask_autopatch.py index 3da871f27f4..4da8fc921f0 100644 --- a/tests/contrib/flask_autopatch/test_flask_autopatch.py +++ b/tests/contrib/flask_autopatch/test_flask_autopatch.py @@ -3,7 +3,7 @@ import wrapt from ddtrace import Pin -from ddtrace.contrib.flask.patch import flask_version +from ddtrace.contrib.internal.flask.patch import flask_version from ddtrace.ext import http from tests.utils import TracerTestCase from tests.utils import assert_is_measured diff --git a/tests/contrib/flask_cache/test.py b/tests/contrib/flask_cache/test.py index 62d3bb11d9c..cd92a85814f 100644 --- a/tests/contrib/flask_cache/test.py +++ b/tests/contrib/flask_cache/test.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from flask import Flask -from ddtrace.contrib.flask_cache import get_traced_cache from ddtrace.contrib.flask_cache.tracers import CACHE_BACKEND +from ddtrace.contrib.internal.flask_cache.tracers import get_traced_cache from ddtrace.ext import net from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/flask_cache/test_utils.py b/tests/contrib/flask_cache/test_utils.py index a527f443033..7d7e200cd9f 100644 --- a/tests/contrib/flask_cache/test_utils.py +++ b/tests/contrib/flask_cache/test_utils.py @@ -3,7 +3,7 @@ from flask import Flask from ddtrace._trace.tracer import Tracer -from ddtrace.contrib.flask_cache import get_traced_cache +from ddtrace.contrib.internal.flask_cache.tracers import get_traced_cache from ddtrace.contrib.internal.flask_cache.utils import _extract_client from ddtrace.contrib.internal.flask_cache.utils import _extract_conn_tags from ddtrace.contrib.internal.flask_cache.utils import _resource_from_cache_prefix diff --git a/tests/contrib/flask_cache/test_wrapper_safety.py b/tests/contrib/flask_cache/test_wrapper_safety.py index d389138e8b1..b8569f93bde 100644 --- a/tests/contrib/flask_cache/test_wrapper_safety.py +++ b/tests/contrib/flask_cache/test_wrapper_safety.py @@ -3,8 +3,8 @@ import pytest from redis.exceptions import ConnectionError -from ddtrace.contrib.flask_cache import get_traced_cache from ddtrace.contrib.flask_cache.tracers import CACHE_BACKEND +from ddtrace.contrib.internal.flask_cache.tracers import get_traced_cache from ddtrace.ext import net from tests.utils import TracerTestCase diff --git a/tests/contrib/freezegun/test_freezegun.py b/tests/contrib/freezegun/test_freezegun.py index a1e624ed0eb..95198486598 100644 --- a/tests/contrib/freezegun/test_freezegun.py +++ b/tests/contrib/freezegun/test_freezegun.py @@ -12,8 +12,8 @@ class TestFreezegunTestCase: @pytest.fixture(autouse=True) def _patch_freezegun(self): - from ddtrace.contrib.freezegun import patch - from ddtrace.contrib.freezegun import unpatch + from ddtrace.contrib.internal.freezegun.patch import patch + from ddtrace.contrib.internal.freezegun.patch import unpatch patch() yield @@ -22,7 +22,7 @@ def _patch_freezegun(self): def test_freezegun_unpatch(self): import freezegun - from ddtrace.contrib.freezegun import unpatch + from ddtrace.contrib.internal.freezegun.patch import unpatch unpatch() @@ -75,7 +75,7 @@ def test_freezegun_pytest_plugin(self): """Tests that pytest's patching of freezegun in the v1 plugin version works""" import sys - from ddtrace.contrib.freezegun import unpatch + from ddtrace.contrib.internal.freezegun.patch import unpatch unpatch() if "freezegun" in sys.modules: diff --git a/tests/contrib/futures/test_futures_patch.py b/tests/contrib/futures/test_futures_patch.py index fca6a316c00..b805dea2e9a 100644 --- a/tests/contrib/futures/test_futures_patch.py +++ b/tests/contrib/futures/test_futures_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.futures import get_version -from ddtrace.contrib.futures.patch import patch +from ddtrace.contrib.internal.futures.patch import get_version +from ddtrace.contrib.internal.futures.patch import patch try: - from ddtrace.contrib.futures.patch import unpatch + from ddtrace.contrib.internal.futures.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/futures/test_propagation.py b/tests/contrib/futures/test_propagation.py index 037aebd9ce5..7f177c566ca 100644 --- a/tests/contrib/futures/test_propagation.py +++ b/tests/contrib/futures/test_propagation.py @@ -4,8 +4,8 @@ import pytest -from ddtrace.contrib.futures import patch -from ddtrace.contrib.futures import unpatch +from ddtrace.contrib.internal.futures.patch import patch +from ddtrace.contrib.internal.futures.patch import unpatch from tests.opentracer.utils import init_tracer from tests.utils import DummyTracer from tests.utils import TracerTestCase diff --git a/tests/contrib/gevent/test_tracer.py b/tests/contrib/gevent/test_tracer.py index a40a0f3cdaf..c34f06d41d6 100644 --- a/tests/contrib/gevent/test_tracer.py +++ b/tests/contrib/gevent/test_tracer.py @@ -9,8 +9,8 @@ from ddtrace.constants import SAMPLING_PRIORITY_KEY from ddtrace.constants import USER_KEEP from ddtrace._trace.context import Context -from ddtrace.contrib.gevent import patch -from ddtrace.contrib.gevent import unpatch +from ddtrace.contrib.internal.gevent.patch import patch +from ddtrace.contrib.internal.gevent.patch import unpatch from tests.opentracer.utils import init_tracer from tests.utils import TracerTestCase diff --git a/tests/contrib/google_generativeai/conftest.py b/tests/contrib/google_generativeai/conftest.py index 7da872255c3..6c370a07452 100644 --- a/tests/contrib/google_generativeai/conftest.py +++ b/tests/contrib/google_generativeai/conftest.py @@ -3,8 +3,8 @@ import mock import pytest -from ddtrace.contrib.google_generativeai import patch -from ddtrace.contrib.google_generativeai import unpatch +from ddtrace.contrib.internal.google_generativeai.patch import patch +from ddtrace.contrib.internal.google_generativeai.patch import unpatch from ddtrace.llmobs import LLMObs from ddtrace.pin import Pin from tests.contrib.google_generativeai.utils import MockGenerativeModelAsyncClient diff --git a/tests/contrib/google_generativeai/test_google_generativeai_patch.py b/tests/contrib/google_generativeai/test_google_generativeai_patch.py index 470e292a303..a98ad7e2d6a 100644 --- a/tests/contrib/google_generativeai/test_google_generativeai_patch.py +++ b/tests/contrib/google_generativeai/test_google_generativeai_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.google_generativeai import get_version -from ddtrace.contrib.google_generativeai import patch -from ddtrace.contrib.google_generativeai import unpatch +from ddtrace.contrib.internal.google_generativeai.patch import get_version +from ddtrace.contrib.internal.google_generativeai.patch import patch +from ddtrace.contrib.internal.google_generativeai.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/graphene/test_graphene.py b/tests/contrib/graphene/test_graphene.py index 47b842f2d75..5dca40212ee 100644 --- a/tests/contrib/graphene/test_graphene.py +++ b/tests/contrib/graphene/test_graphene.py @@ -1,8 +1,8 @@ import graphene import pytest -from ddtrace.contrib.graphql import patch -from ddtrace.contrib.graphql import unpatch +from ddtrace.contrib.internal.graphql.patch import patch +from ddtrace.contrib.internal.graphql.patch import unpatch from tests.utils import override_config diff --git a/tests/contrib/graphql/test_graphql.py b/tests/contrib/graphql/test_graphql.py index 67c5befd7fe..f6eca690b36 100644 --- a/tests/contrib/graphql/test_graphql.py +++ b/tests/contrib/graphql/test_graphql.py @@ -4,9 +4,9 @@ import pytest from ddtrace import tracer -from ddtrace.contrib.graphql import patch -from ddtrace.contrib.graphql import unpatch from ddtrace.contrib.internal.graphql.patch import _graphql_version as graphql_version +from ddtrace.contrib.internal.graphql.patch import patch +from ddtrace.contrib.internal.graphql.patch import unpatch from tests.utils import override_config from tests.utils import snapshot diff --git a/tests/contrib/graphql/test_graphql_patch.py b/tests/contrib/graphql/test_graphql_patch.py index 951e69998f3..5504a29ef06 100644 --- a/tests/contrib/graphql/test_graphql_patch.py +++ b/tests/contrib/graphql/test_graphql_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.graphql import get_version -from ddtrace.contrib.graphql.patch import patch +from ddtrace.contrib.internal.graphql.patch import get_version +from ddtrace.contrib.internal.graphql.patch import patch try: - from ddtrace.contrib.graphql.patch import unpatch + from ddtrace.contrib.internal.graphql.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/grpc/common.py b/tests/contrib/grpc/common.py index e45db8e6473..668a99d2584 100644 --- a/tests/contrib/grpc/common.py +++ b/tests/contrib/grpc/common.py @@ -3,9 +3,9 @@ from grpc.framework.foundation import logging_pool from ddtrace import Pin -from ddtrace.contrib.grpc import constants -from ddtrace.contrib.grpc import patch -from ddtrace.contrib.grpc import unpatch +from ddtrace.contrib.internal.grpc import constants +from ddtrace.contrib.internal.grpc.patch import patch +from ddtrace.contrib.internal.grpc.patch import unpatch from tests.utils import TracerTestCase from .hello_pb2_grpc import add_HelloServicer_to_server diff --git a/tests/contrib/grpc/test_constants.py b/tests/contrib/grpc/test_constants.py index 5ff9e4b6aa2..5c8238ae126 100644 --- a/tests/contrib/grpc/test_constants.py +++ b/tests/contrib/grpc/test_constants.py @@ -4,7 +4,7 @@ def test_not_deprecated(): - from ddtrace.contrib.grpc import constants as grpc_constants + from ddtrace.contrib.internal.grpc import constants as grpc_constants with warnings.catch_warnings(record=True) as warns: warnings.simplefilter("always") diff --git a/tests/contrib/grpc/test_grpc.py b/tests/contrib/grpc/test_grpc.py index fdde555c83d..8f6bd00b4e3 100644 --- a/tests/contrib/grpc/test_grpc.py +++ b/tests/contrib/grpc/test_grpc.py @@ -11,9 +11,9 @@ from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE from ddtrace.contrib.grpc import constants -from ddtrace.contrib.grpc import patch -from ddtrace.contrib.grpc import unpatch from ddtrace.contrib.internal.grpc.patch import _unpatch_server +from ddtrace.contrib.internal.grpc.patch import patch +from ddtrace.contrib.internal.grpc.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import TracerTestCase from tests.utils import flaky diff --git a/tests/contrib/grpc/test_grpc_patch.py b/tests/contrib/grpc/test_grpc_patch.py index 805b6996a3c..6a50342367f 100644 --- a/tests/contrib/grpc/test_grpc_patch.py +++ b/tests/contrib/grpc/test_grpc_patch.py @@ -1,5 +1,5 @@ -from ddtrace.contrib.grpc import get_version -from ddtrace.contrib.grpc import patch +from ddtrace.contrib.internal.grpc.patch import get_version +from ddtrace.contrib.internal.grpc.patch import patch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/grpc_aio/test_grpc_aio.py b/tests/contrib/grpc_aio/test_grpc_aio.py index ff09cf198ce..1296e027486 100644 --- a/tests/contrib/grpc_aio/test_grpc_aio.py +++ b/tests/contrib/grpc_aio/test_grpc_aio.py @@ -11,10 +11,10 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.grpc import patch -from ddtrace.contrib.grpc import unpatch -from ddtrace.contrib.grpc.patch import GRPC_AIO_PIN_MODULE_CLIENT -from ddtrace.contrib.grpc.patch import GRPC_AIO_PIN_MODULE_SERVER +from ddtrace.contrib.internal.grpc.patch import GRPC_AIO_PIN_MODULE_CLIENT +from ddtrace.contrib.internal.grpc.patch import GRPC_AIO_PIN_MODULE_SERVER +from ddtrace.contrib.internal.grpc.patch import patch +from ddtrace.contrib.internal.grpc.patch import unpatch from ddtrace.contrib.internal.grpc.utils import _parse_rpc_repr_string import ddtrace.vendor.packaging.version as packaging_version from tests.contrib.grpc.hello_pb2 import HelloReply diff --git a/tests/contrib/gunicorn/wsgi_mw_app.py b/tests/contrib/gunicorn/wsgi_mw_app.py index 26f46033e65..ac3931923c7 100644 --- a/tests/contrib/gunicorn/wsgi_mw_app.py +++ b/tests/contrib/gunicorn/wsgi_mw_app.py @@ -11,7 +11,7 @@ import json from ddtrace import tracer -from ddtrace.contrib.wsgi import DDWSGIMiddleware +from ddtrace.contrib.internal.wsgi.wsgi import DDWSGIMiddleware from ddtrace.profiling import bootstrap import ddtrace.profiling.auto # noqa:F401 from tests.webclient import PingFilter diff --git a/tests/contrib/httplib/test_httplib.py b/tests/contrib/httplib/test_httplib.py index edc888ad3eb..05977b53cc5 100644 --- a/tests/contrib/httplib/test_httplib.py +++ b/tests/contrib/httplib/test_httplib.py @@ -9,9 +9,9 @@ import wrapt from ddtrace import config -from ddtrace.contrib.httplib import patch -from ddtrace.contrib.httplib import unpatch -from ddtrace.contrib.httplib.patch import should_skip_request +from ddtrace.contrib.internal.httplib.patch import patch +from ddtrace.contrib.internal.httplib.patch import should_skip_request +from ddtrace.contrib.internal.httplib.patch import unpatch from ddtrace.ext import http from ddtrace.internal.compat import httplib from ddtrace.internal.compat import parse diff --git a/tests/contrib/httplib/test_httplib_patch.py b/tests/contrib/httplib/test_httplib_patch.py index 420f76bc302..dd8018f27ed 100644 --- a/tests/contrib/httplib/test_httplib_patch.py +++ b/tests/contrib/httplib/test_httplib_patch.py @@ -1,9 +1,9 @@ -from ddtrace.contrib.httplib.patch import get_version -from ddtrace.contrib.httplib.patch import patch +from ddtrace.contrib.internal.httplib.patch import get_version +from ddtrace.contrib.internal.httplib.patch import patch try: - from ddtrace.contrib.httplib.patch import unpatch + from ddtrace.contrib.internal.httplib.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/httpx/test_httpx.py b/tests/contrib/httpx/test_httpx.py index 43841d73f23..426099dcf04 100644 --- a/tests/contrib/httpx/test_httpx.py +++ b/tests/contrib/httpx/test_httpx.py @@ -3,9 +3,9 @@ from wrapt import ObjectProxy from ddtrace import config -from ddtrace.contrib.httpx.patch import HTTPX_VERSION -from ddtrace.contrib.httpx.patch import patch -from ddtrace.contrib.httpx.patch import unpatch +from ddtrace.contrib.internal.httpx.patch import HTTPX_VERSION +from ddtrace.contrib.internal.httpx.patch import patch +from ddtrace.contrib.internal.httpx.patch import unpatch from ddtrace.pin import Pin from ddtrace.settings.http import HttpConfig from tests.utils import flaky @@ -165,7 +165,7 @@ def test_configure_service_name_env(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -202,7 +202,7 @@ def test_schematized_configure_global_service_name_env_default(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -236,7 +236,7 @@ def test_schematized_configure_global_service_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -270,7 +270,7 @@ def test_schematized_configure_global_service_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -303,7 +303,7 @@ def test_schematized_unspecified_service_name_env_default(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -336,7 +336,7 @@ def test_schematized_unspecified_service_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -368,7 +368,7 @@ def test_schematized_unspecified_service_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -401,7 +401,7 @@ def test_schematized_operation_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -433,7 +433,7 @@ def test_schematized_operation_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -598,7 +598,7 @@ def test_distributed_tracing_disabled_env(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url patch() diff --git a/tests/contrib/httpx/test_httpx_patch.py b/tests/contrib/httpx/test_httpx_patch.py index 5062fb2c575..e3a62fc99ef 100644 --- a/tests/contrib/httpx/test_httpx_patch.py +++ b/tests/contrib/httpx/test_httpx_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.httpx import get_version -from ddtrace.contrib.httpx.patch import patch +from ddtrace.contrib.internal.httpx.patch import get_version +from ddtrace.contrib.internal.httpx.patch import patch try: - from ddtrace.contrib.httpx.patch import unpatch + from ddtrace.contrib.internal.httpx.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/httpx/test_httpx_pre_0_11.py b/tests/contrib/httpx/test_httpx_pre_0_11.py index ed4a70e047d..fc9c003328c 100644 --- a/tests/contrib/httpx/test_httpx_pre_0_11.py +++ b/tests/contrib/httpx/test_httpx_pre_0_11.py @@ -3,9 +3,9 @@ from wrapt import ObjectProxy from ddtrace import config -from ddtrace.contrib.httpx.patch import HTTPX_VERSION -from ddtrace.contrib.httpx.patch import patch -from ddtrace.contrib.httpx.patch import unpatch +from ddtrace.contrib.internal.httpx.patch import HTTPX_VERSION +from ddtrace.contrib.internal.httpx.patch import patch +from ddtrace.contrib.internal.httpx.patch import unpatch from ddtrace.pin import Pin from ddtrace.settings.http import HttpConfig from tests.utils import override_config @@ -143,7 +143,7 @@ def test_configure_service_name_env(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -172,7 +172,7 @@ def test_configure_global_service_name_env(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -201,7 +201,7 @@ def test_schematized_configure_global_service_name_env_default(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -230,7 +230,7 @@ def test_schematized_configure_global_service_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -259,7 +259,7 @@ def test_schematized_configure_global_service_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -287,7 +287,7 @@ def test_schematized_unspecified_service_name_env_default(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -315,7 +315,7 @@ def test_schematized_unspecified_service_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -343,7 +343,7 @@ def test_schematized_unspecified_service_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -371,7 +371,7 @@ def test_schematized_operation_name_env_v0(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -399,7 +399,7 @@ def test_schematized_operation_name_env_v1(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url from tests.utils import snapshot_context @@ -536,7 +536,7 @@ def test_distributed_tracing_disabled_env(): import httpx - from ddtrace.contrib.httpx import patch + from ddtrace.contrib.internal.httpx.patch import patch from tests.contrib.httpx.test_httpx import get_url patch() diff --git a/tests/contrib/jinja2/test_jinja2.py b/tests/contrib/jinja2/test_jinja2.py index fe675ffd9b3..985c1114383 100644 --- a/tests/contrib/jinja2/test_jinja2.py +++ b/tests/contrib/jinja2/test_jinja2.py @@ -6,8 +6,8 @@ from ddtrace import Pin from ddtrace import config -from ddtrace.contrib.jinja2 import patch -from ddtrace.contrib.jinja2 import unpatch +from ddtrace.contrib.internal.jinja2.patch import patch +from ddtrace.contrib.internal.jinja2.patch import unpatch from tests.utils import TracerTestCase from tests.utils import assert_is_measured from tests.utils import assert_is_not_measured diff --git a/tests/contrib/jinja2/test_jinja2_patch.py b/tests/contrib/jinja2/test_jinja2_patch.py index ec65e5276e3..4b4256e672f 100644 --- a/tests/contrib/jinja2/test_jinja2_patch.py +++ b/tests/contrib/jinja2/test_jinja2_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.jinja2 import get_version -from ddtrace.contrib.jinja2.patch import patch +from ddtrace.contrib.internal.jinja2.patch import get_version +from ddtrace.contrib.internal.jinja2.patch import patch try: - from ddtrace.contrib.jinja2.patch import unpatch + from ddtrace.contrib.internal.jinja2.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/kafka/test_kafka.py b/tests/contrib/kafka/test_kafka.py index d49f85f26b2..be49a45ae7f 100644 --- a/tests/contrib/kafka/test_kafka.py +++ b/tests/contrib/kafka/test_kafka.py @@ -13,9 +13,9 @@ from ddtrace import Pin from ddtrace import Tracer -from ddtrace.contrib.kafka.patch import TracedConsumer -from ddtrace.contrib.kafka.patch import patch -from ddtrace.contrib.kafka.patch import unpatch +from ddtrace.contrib.internal.kafka.patch import TracedConsumer +from ddtrace.contrib.internal.kafka.patch import patch +from ddtrace.contrib.internal.kafka.patch import unpatch from ddtrace.filters import TraceFilter import ddtrace.internal.datastreams # noqa: F401 - used as part of mock patching from ddtrace.internal.datastreams.processor import PROPAGATION_KEY_BASE_64 @@ -498,8 +498,8 @@ def test_data_streams_kafka(dsm_processor, consumer, producer, kafka_topic): def _generate_in_subprocess(random_topic): import ddtrace - from ddtrace.contrib.kafka.patch import patch - from ddtrace.contrib.kafka.patch import unpatch + from ddtrace.contrib.internal.kafka.patch import patch + from ddtrace.contrib.internal.kafka.patch import unpatch from tests.contrib.kafka.test_kafka import KafkaConsumerPollFilter PAYLOAD = bytes("hueh hueh hueh", encoding="utf-8") @@ -799,7 +799,7 @@ def test_tracing_context_is_propagated_when_enabled(ddtrace_run_python_code_in_s import sys from ddtrace import Pin -from ddtrace.contrib.kafka.patch import patch +from ddtrace.contrib.internal.kafka.patch import patch from tests.contrib.kafka.test_kafka import consumer from tests.contrib.kafka.test_kafka import kafka_topic @@ -1039,7 +1039,7 @@ def test_does_not_trace_empty_poll_when_disabled(ddtrace_run_python_code_in_subp import sys from ddtrace import Pin -from ddtrace.contrib.kafka.patch import patch +from ddtrace.contrib.internal.kafka.patch import patch from ddtrace import config from tests.contrib.kafka.test_kafka import consumer diff --git a/tests/contrib/kafka/test_kafka_patch.py b/tests/contrib/kafka/test_kafka_patch.py index 23adc8503af..53e82ca2ee5 100644 --- a/tests/contrib/kafka/test_kafka_patch.py +++ b/tests/contrib/kafka/test_kafka_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.kafka.patch import get_version -from ddtrace.contrib.kafka.patch import patch -from ddtrace.contrib.kafka.patch import unpatch +from ddtrace.contrib.internal.kafka.patch import get_version +from ddtrace.contrib.internal.kafka.patch import patch +from ddtrace.contrib.internal.kafka.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/kombu/test.py b/tests/contrib/kombu/test.py index bb666d7a52e..ef27d3a09ac 100644 --- a/tests/contrib/kombu/test.py +++ b/tests/contrib/kombu/test.py @@ -3,9 +3,9 @@ import mock from ddtrace import Pin -from ddtrace.contrib.kombu import utils -from ddtrace.contrib.kombu.patch import patch -from ddtrace.contrib.kombu.patch import unpatch +from ddtrace.contrib.internal.kombu import utils +from ddtrace.contrib.internal.kombu.patch import patch +from ddtrace.contrib.internal.kombu.patch import unpatch from ddtrace.ext import kombu as kombux from ddtrace.internal.datastreams.processor import PROPAGATION_KEY_BASE_64 from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/kombu/test_kombu_patch.py b/tests/contrib/kombu/test_kombu_patch.py index 908cd920489..dde0dfbb1c1 100644 --- a/tests/contrib/kombu/test_kombu_patch.py +++ b/tests/contrib/kombu/test_kombu_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.kombu import get_version -from ddtrace.contrib.kombu.patch import patch +from ddtrace.contrib.internal.kombu.patch import get_version +from ddtrace.contrib.internal.kombu.patch import patch try: - from ddtrace.contrib.kombu.patch import unpatch + from ddtrace.contrib.internal.kombu.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/langchain/conftest.py b/tests/contrib/langchain/conftest.py index 5403417f42e..f280237fc99 100644 --- a/tests/contrib/langchain/conftest.py +++ b/tests/contrib/langchain/conftest.py @@ -5,7 +5,7 @@ from ddtrace import Pin from ddtrace import patch -from ddtrace.contrib.langchain.patch import unpatch +from ddtrace.contrib.internal.langchain.patch import unpatch from tests.utils import DummyTracer from tests.utils import DummyWriter from tests.utils import override_config diff --git a/tests/contrib/langchain/test_langchain_patch.py b/tests/contrib/langchain/test_langchain_patch.py index 16bd03b1327..dafd38d7575 100644 --- a/tests/contrib/langchain/test_langchain_patch.py +++ b/tests/contrib/langchain/test_langchain_patch.py @@ -1,9 +1,9 @@ -from ddtrace.contrib.langchain import get_version -from ddtrace.contrib.langchain import patch -from ddtrace.contrib.langchain import unpatch +from ddtrace.contrib.internal.langchain.patch import PATCH_LANGCHAIN_V0 +from ddtrace.contrib.internal.langchain.patch import get_version +from ddtrace.contrib.internal.langchain.patch import patch +from ddtrace.contrib.internal.langchain.patch import unpatch from ddtrace.contrib.langchain.constants import text_embedding_models from ddtrace.contrib.langchain.constants import vectorstore_classes -from ddtrace.contrib.langchain.patch import PATCH_LANGCHAIN_V0 from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/logbook/test_logbook_logging.py b/tests/contrib/logbook/test_logbook_logging.py index f8b858449b4..d9d67da82f4 100644 --- a/tests/contrib/logbook/test_logbook_logging.py +++ b/tests/contrib/logbook/test_logbook_logging.py @@ -7,8 +7,8 @@ from ddtrace.constants import ENV_KEY from ddtrace.constants import SERVICE_KEY from ddtrace.constants import VERSION_KEY -from ddtrace.contrib.logbook import patch -from ddtrace.contrib.logbook import unpatch +from ddtrace.contrib.internal.logbook.patch import patch +from ddtrace.contrib.internal.logbook.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS from tests.utils import override_global_config @@ -78,8 +78,8 @@ def test_log_trace(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.logbook import patch - from ddtrace.contrib.logbook import unpatch + from ddtrace.contrib.internal.logbook.patch import patch + from ddtrace.contrib.internal.logbook.patch import unpatch config.service = "logging" config.env = "global.env" @@ -116,8 +116,8 @@ def test_log_trace_128bit_trace_ids(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.logbook import patch - from ddtrace.contrib.logbook import unpatch + from ddtrace.contrib.internal.logbook.patch import patch + from ddtrace.contrib.internal.logbook.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS config.service = "logging" @@ -151,8 +151,8 @@ def test_log_DD_TAGS(): from logbook import TestHandler from ddtrace import tracer - from ddtrace.contrib.logbook import patch - from ddtrace.contrib.logbook import unpatch + from ddtrace.contrib.internal.logbook.patch import patch + from ddtrace.contrib.internal.logbook.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS handler = TestHandler() diff --git a/tests/contrib/logbook/test_logbook_patch.py b/tests/contrib/logbook/test_logbook_patch.py index 0be19c170db..ad434c8fba6 100644 --- a/tests/contrib/logbook/test_logbook_patch.py +++ b/tests/contrib/logbook/test_logbook_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.logbook import get_version -from ddtrace.contrib.logbook.patch import patch +from ddtrace.contrib.internal.logbook.patch import get_version +from ddtrace.contrib.internal.logbook.patch import patch try: - from ddtrace.contrib.logbook.patch import unpatch + from ddtrace.contrib.internal.logbook.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/logging/test_logging.py b/tests/contrib/logging/test_logging.py index 2e85d73e386..4983e074e6e 100644 --- a/tests/contrib/logging/test_logging.py +++ b/tests/contrib/logging/test_logging.py @@ -5,8 +5,8 @@ import ddtrace from ddtrace.constants import ENV_KEY from ddtrace.constants import VERSION_KEY -from ddtrace.contrib.logging import patch -from ddtrace.contrib.logging import unpatch +from ddtrace.contrib.internal.logging.patch import patch +from ddtrace.contrib.internal.logging.patch import unpatch from ddtrace.contrib.logging.constants import RECORD_ATTR_SPAN_ID from ddtrace.contrib.logging.constants import RECORD_ATTR_TRACE_ID from ddtrace.internal.compat import StringIO diff --git a/tests/contrib/logging/test_logging_patch.py b/tests/contrib/logging/test_logging_patch.py index 94e4c975a81..e4f92436eda 100644 --- a/tests/contrib/logging/test_logging_patch.py +++ b/tests/contrib/logging/test_logging_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.logging import get_version -from ddtrace.contrib.logging.patch import patch +from ddtrace.contrib.internal.logging.patch import get_version +from ddtrace.contrib.internal.logging.patch import patch try: - from ddtrace.contrib.logging.patch import unpatch + from ddtrace.contrib.internal.logging.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/loguru/test_loguru_logging.py b/tests/contrib/loguru/test_loguru_logging.py index 0c2361aff41..7ea8baddddb 100644 --- a/tests/contrib/loguru/test_loguru_logging.py +++ b/tests/contrib/loguru/test_loguru_logging.py @@ -9,8 +9,8 @@ from ddtrace.constants import ENV_KEY from ddtrace.constants import SERVICE_KEY from ddtrace.constants import VERSION_KEY -from ddtrace.contrib.loguru import patch -from ddtrace.contrib.loguru import unpatch +from ddtrace.contrib.internal.loguru.patch import patch +from ddtrace.contrib.internal.loguru.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS from tests.utils import override_global_config diff --git a/tests/contrib/loguru/test_loguru_patch.py b/tests/contrib/loguru/test_loguru_patch.py index fa9166fa251..4e919050ad0 100644 --- a/tests/contrib/loguru/test_loguru_patch.py +++ b/tests/contrib/loguru/test_loguru_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.loguru import get_version -from ddtrace.contrib.loguru.patch import patch +from ddtrace.contrib.internal.loguru.patch import get_version +from ddtrace.contrib.internal.loguru.patch import patch try: - from ddtrace.contrib.loguru.patch import unpatch + from ddtrace.contrib.internal.loguru.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/mako/test_mako.py b/tests/contrib/mako/test_mako.py index dca66e7a38b..617097470a5 100644 --- a/tests/contrib/mako/test_mako.py +++ b/tests/contrib/mako/test_mako.py @@ -5,8 +5,8 @@ from mako.template import Template from ddtrace import Pin -from ddtrace.contrib.mako import patch -from ddtrace.contrib.mako import unpatch +from ddtrace.contrib.internal.mako.patch import patch +from ddtrace.contrib.internal.mako.patch import unpatch from ddtrace.contrib.mako.constants import DEFAULT_TEMPLATE_NAME from ddtrace.internal.compat import StringIO from ddtrace.internal.compat import to_unicode diff --git a/tests/contrib/mako/test_mako_patch.py b/tests/contrib/mako/test_mako_patch.py index 17e23677b0d..e83f0a2f9fb 100644 --- a/tests/contrib/mako/test_mako_patch.py +++ b/tests/contrib/mako/test_mako_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.mako import get_version -from ddtrace.contrib.mako.patch import patch +from ddtrace.contrib.internal.mako.patch import get_version +from ddtrace.contrib.internal.mako.patch import patch try: - from ddtrace.contrib.mako.patch import unpatch + from ddtrace.contrib.internal.mako.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/mariadb/test_mariadb.py b/tests/contrib/mariadb/test_mariadb.py index 3c5768389bc..05a3718d219 100644 --- a/tests/contrib/mariadb/test_mariadb.py +++ b/tests/contrib/mariadb/test_mariadb.py @@ -5,8 +5,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.mariadb import patch -from ddtrace.contrib.mariadb import unpatch +from ddtrace.contrib.internal.mariadb.patch import patch +from ddtrace.contrib.internal.mariadb.patch import unpatch from tests.contrib.config import MARIADB_CONFIG from tests.utils import DummyTracer from tests.utils import assert_dict_issuperset diff --git a/tests/contrib/mariadb/test_mariadb_patch.py b/tests/contrib/mariadb/test_mariadb_patch.py index 8dd47b216b3..8ad25102bfb 100644 --- a/tests/contrib/mariadb/test_mariadb_patch.py +++ b/tests/contrib/mariadb/test_mariadb_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.mariadb import get_version -from ddtrace.contrib.mariadb.patch import patch +from ddtrace.contrib.internal.mariadb.patch import get_version +from ddtrace.contrib.internal.mariadb.patch import patch try: - from ddtrace.contrib.mariadb.patch import unpatch + from ddtrace.contrib.internal.mariadb.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/molten/test_molten.py b/tests/contrib/molten/test_molten.py index 08a15551ae7..d0b1eb1648f 100644 --- a/tests/contrib/molten/test_molten.py +++ b/tests/contrib/molten/test_molten.py @@ -5,9 +5,9 @@ from ddtrace import Pin from ddtrace import config from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.molten import patch -from ddtrace.contrib.molten import unpatch -from ddtrace.contrib.molten.patch import MOLTEN_VERSION +from ddtrace.contrib.internal.molten.patch import MOLTEN_VERSION +from ddtrace.contrib.internal.molten.patch import patch +from ddtrace.contrib.internal.molten.patch import unpatch from ddtrace.ext import http from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.propagation.http import HTTP_HEADER_PARENT_ID diff --git a/tests/contrib/molten/test_molten_di.py b/tests/contrib/molten/test_molten_di.py index 8c6f03a4786..f320dd01e64 100644 --- a/tests/contrib/molten/test_molten_di.py +++ b/tests/contrib/molten/test_molten_di.py @@ -4,8 +4,8 @@ from molten import DependencyInjector from ddtrace import Pin -from ddtrace.contrib.molten import patch -from ddtrace.contrib.molten import unpatch +from ddtrace.contrib.internal.molten.patch import patch +from ddtrace.contrib.internal.molten.patch import unpatch from tests.utils import TracerTestCase diff --git a/tests/contrib/molten/test_molten_patch.py b/tests/contrib/molten/test_molten_patch.py index 73a13a3e463..ac0b7c962a6 100644 --- a/tests/contrib/molten/test_molten_patch.py +++ b/tests/contrib/molten/test_molten_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.molten import get_version -from ddtrace.contrib.molten.patch import patch +from ddtrace.contrib.internal.molten.patch import get_version +from ddtrace.contrib.internal.molten.patch import patch try: - from ddtrace.contrib.molten.patch import unpatch + from ddtrace.contrib.internal.molten.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/mongoengine/test.py b/tests/contrib/mongoengine/test.py index b34d500291c..0f41ac61d8b 100644 --- a/tests/contrib/mongoengine/test.py +++ b/tests/contrib/mongoengine/test.py @@ -4,8 +4,8 @@ import pymongo from ddtrace import Pin -from ddtrace.contrib.mongoengine.patch import patch -from ddtrace.contrib.mongoengine.patch import unpatch +from ddtrace.contrib.internal.mongoengine.patch import patch +from ddtrace.contrib.internal.mongoengine.patch import unpatch from ddtrace.ext import mongo as mongox from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/mongoengine/test_mongoengine_patch.py b/tests/contrib/mongoengine/test_mongoengine_patch.py index f6d994cec0f..6f219d1566e 100644 --- a/tests/contrib/mongoengine/test_mongoengine_patch.py +++ b/tests/contrib/mongoengine/test_mongoengine_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.mongoengine import get_version -from ddtrace.contrib.mongoengine.patch import patch +from ddtrace.contrib.internal.mongoengine.patch import get_version +from ddtrace.contrib.internal.mongoengine.patch import patch try: - from ddtrace.contrib.mongoengine.patch import unpatch + from ddtrace.contrib.internal.mongoengine.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/mysql/test_mysql.py b/tests/contrib/mysql/test_mysql.py index 777b5d341fa..0c80d4a2c57 100644 --- a/tests/contrib/mysql/test_mysql.py +++ b/tests/contrib/mysql/test_mysql.py @@ -2,8 +2,8 @@ import mysql from ddtrace import Pin -from ddtrace.contrib.mysql.patch import patch -from ddtrace.contrib.mysql.patch import unpatch +from ddtrace.contrib.internal.mysql.patch import patch +from ddtrace.contrib.internal.mysql.patch import unpatch from tests.contrib import shared_tests from tests.contrib.config import MYSQL_CONFIG from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/mysql/test_mysql_patch.py b/tests/contrib/mysql/test_mysql_patch.py index e69f9781cc4..6e10950dac9 100644 --- a/tests/contrib/mysql/test_mysql_patch.py +++ b/tests/contrib/mysql/test_mysql_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.mysql import get_version -from ddtrace.contrib.mysql.patch import patch +from ddtrace.contrib.internal.mysql.patch import get_version +from ddtrace.contrib.internal.mysql.patch import patch try: - from ddtrace.contrib.mysql.patch import unpatch + from ddtrace.contrib.internal.mysql.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/mysqldb/test_mysqldb.py b/tests/contrib/mysqldb/test_mysqldb.py index 9d0d4e29a5e..e27163b649a 100644 --- a/tests/contrib/mysqldb/test_mysqldb.py +++ b/tests/contrib/mysqldb/test_mysqldb.py @@ -3,8 +3,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.mysqldb.patch import patch -from ddtrace.contrib.mysqldb.patch import unpatch +from ddtrace.contrib.internal.mysqldb.patch import patch +from ddtrace.contrib.internal.mysqldb.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib import shared_tests from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/mysqldb/test_mysqldb_patch.py b/tests/contrib/mysqldb/test_mysqldb_patch.py index e17ce852f56..1822231851f 100644 --- a/tests/contrib/mysqldb/test_mysqldb_patch.py +++ b/tests/contrib/mysqldb/test_mysqldb_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.mysqldb import get_version -from ddtrace.contrib.mysqldb.patch import patch +from ddtrace.contrib.internal.mysqldb.patch import get_version +from ddtrace.contrib.internal.mysqldb.patch import patch try: - from ddtrace.contrib.mysqldb.patch import unpatch + from ddtrace.contrib.internal.mysqldb.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/openai/conftest.py b/tests/contrib/openai/conftest.py index d7cb896b704..fa82d3fcdbc 100644 --- a/tests/contrib/openai/conftest.py +++ b/tests/contrib/openai/conftest.py @@ -9,7 +9,7 @@ from ddtrace import Pin from ddtrace import patch -from ddtrace.contrib.openai.patch import unpatch +from ddtrace.contrib.internal.openai.patch import unpatch from ddtrace.filters import TraceFilter from ddtrace.llmobs import LLMObs from tests.utils import DummyTracer diff --git a/tests/contrib/openai/test_openai_patch.py b/tests/contrib/openai/test_openai_patch.py index e2fa8cb88c3..caab79117cf 100644 --- a/tests/contrib/openai/test_openai_patch.py +++ b/tests/contrib/openai/test_openai_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.openai import get_version -from ddtrace.contrib.openai.patch import patch +from ddtrace.contrib.internal.openai.patch import get_version +from ddtrace.contrib.internal.openai.patch import patch try: - from ddtrace.contrib.openai.patch import unpatch + from ddtrace.contrib.internal.openai.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/patch.py b/tests/contrib/patch.py index 913b3895894..32ccb18d11a 100644 --- a/tests/contrib/patch.py +++ b/tests/contrib/patch.py @@ -150,7 +150,7 @@ class Base(SubprocessTestCase, PatchMixin): Example: A simple implementation inheriting this TestCase looks like:: - from ddtrace.contrib.redis import patch, unpatch + from ddtrace.contrib.internal.redis.patch import patch, unpatch class RedisPatchTestCase(PatchTestCase.Base): __integration_name__ = 'redis' @@ -454,7 +454,7 @@ def test_import_patch_unpatch_patch(self): For example:: import redis - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() @@ -480,7 +480,7 @@ def test_patch_import_unpatch_patch(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) import redis @@ -506,7 +506,7 @@ def test_patch_unpatch_import_patch(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) import redis @@ -531,7 +531,7 @@ def test_patch_unpatch_patch_import(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() @@ -553,7 +553,7 @@ def test_unpatch_patch_import(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch unpatch() ddtrace.patch(redis=True) import redis @@ -576,7 +576,7 @@ def test_patch_unpatch_import(self): For example:: ddtrace.patch(redis=True) - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch unpatch() import redis self.assert_not_module_patched(redis) @@ -596,7 +596,7 @@ def test_import_unpatch_patch(self): For example:: import redis - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() self.assert_not_module_patched(redis) @@ -617,7 +617,7 @@ def test_import_patch_unpatch(self): For example:: import redis - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() self.assert_not_module_patched(redis) @@ -638,7 +638,7 @@ def test_patch_import_unpatch(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) import redis unpatch() @@ -659,7 +659,7 @@ def test_import_patch_unpatch_unpatch(self): For example:: import redis - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) self.assert_module_patched(redis) @@ -684,7 +684,7 @@ def test_patch_unpatch_import_unpatch(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() @@ -708,7 +708,7 @@ def test_patch_unpatch_unpatch_import(self): For example:: - from ddtrace.contrib.redis import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch ddtrace.patch(redis=True) unpatch() diff --git a/tests/contrib/psycopg/test_psycopg.py b/tests/contrib/psycopg/test_psycopg.py index f21915548fb..d7821ca8905 100644 --- a/tests/contrib/psycopg/test_psycopg.py +++ b/tests/contrib/psycopg/test_psycopg.py @@ -9,8 +9,8 @@ from psycopg.sql import Literal from ddtrace import Pin -from ddtrace.contrib.psycopg.patch import patch -from ddtrace.contrib.psycopg.patch import unpatch +from ddtrace.contrib.internal.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.internal.utils.version import parse_version from tests.contrib.config import POSTGRES_CONFIG diff --git a/tests/contrib/psycopg/test_psycopg_async.py b/tests/contrib/psycopg/test_psycopg_async.py index 08b84e0afd0..7a8654f1626 100644 --- a/tests/contrib/psycopg/test_psycopg_async.py +++ b/tests/contrib/psycopg/test_psycopg_async.py @@ -6,8 +6,8 @@ from psycopg.sql import Literal from ddtrace import Pin -from ddtrace.contrib.psycopg.patch import patch -from ddtrace.contrib.psycopg.patch import unpatch +from ddtrace.contrib.internal.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import unpatch from tests.contrib.asyncio.utils import AsyncioTestCase from tests.contrib.config import POSTGRES_CONFIG from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/psycopg/test_psycopg_patch.py b/tests/contrib/psycopg/test_psycopg_patch.py index 8d91b2b07d7..1dd316b0423 100644 --- a/tests/contrib/psycopg/test_psycopg_patch.py +++ b/tests/contrib/psycopg/test_psycopg_patch.py @@ -3,13 +3,13 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.psycopg.patch import get_version -from ddtrace.contrib.psycopg.patch import get_versions -from ddtrace.contrib.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import get_version +from ddtrace.contrib.internal.psycopg.patch import get_versions +from ddtrace.contrib.internal.psycopg.patch import patch try: - from ddtrace.contrib.psycopg.patch import unpatch + from ddtrace.contrib.internal.psycopg.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/psycopg/test_psycopg_snapshot.py b/tests/contrib/psycopg/test_psycopg_snapshot.py index 00b0a679991..c4f904bfaa4 100644 --- a/tests/contrib/psycopg/test_psycopg_snapshot.py +++ b/tests/contrib/psycopg/test_psycopg_snapshot.py @@ -5,8 +5,8 @@ import pytest import wrapt -from ddtrace.contrib.psycopg.patch import patch -from ddtrace.contrib.psycopg.patch import unpatch +from ddtrace.contrib.internal.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import unpatch @pytest.fixture(autouse=True) diff --git a/tests/contrib/psycopg2/test_psycopg.py b/tests/contrib/psycopg2/test_psycopg.py index 7b13114f064..eeea555d396 100644 --- a/tests/contrib/psycopg2/test_psycopg.py +++ b/tests/contrib/psycopg2/test_psycopg.py @@ -8,8 +8,8 @@ from psycopg2 import extras from ddtrace import Pin -from ddtrace.contrib.psycopg.patch import patch -from ddtrace.contrib.psycopg.patch import unpatch +from ddtrace.contrib.internal.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.internal.utils.version import parse_version from tests.contrib.config import POSTGRES_CONFIG diff --git a/tests/contrib/psycopg2/test_psycopg_patch.py b/tests/contrib/psycopg2/test_psycopg_patch.py index 21172763b77..1d3db62ec76 100644 --- a/tests/contrib/psycopg2/test_psycopg_patch.py +++ b/tests/contrib/psycopg2/test_psycopg_patch.py @@ -3,13 +3,13 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.psycopg.patch import get_version -from ddtrace.contrib.psycopg.patch import get_versions -from ddtrace.contrib.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import get_version +from ddtrace.contrib.internal.psycopg.patch import get_versions +from ddtrace.contrib.internal.psycopg.patch import patch try: - from ddtrace.contrib.psycopg.patch import unpatch + from ddtrace.contrib.internal.psycopg.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/psycopg2/test_psycopg_snapshot.py b/tests/contrib/psycopg2/test_psycopg_snapshot.py index c3210077598..6947faf15b8 100644 --- a/tests/contrib/psycopg2/test_psycopg_snapshot.py +++ b/tests/contrib/psycopg2/test_psycopg_snapshot.py @@ -4,8 +4,8 @@ import pytest import wrapt -from ddtrace.contrib.psycopg.patch import patch -from ddtrace.contrib.psycopg.patch import unpatch +from ddtrace.contrib.internal.psycopg.patch import patch +from ddtrace.contrib.internal.psycopg.patch import unpatch @pytest.fixture(autouse=True) diff --git a/tests/contrib/pylibmc/test.py b/tests/contrib/pylibmc/test.py index 2cd698681bf..7a112677c27 100644 --- a/tests/contrib/pylibmc/test.py +++ b/tests/contrib/pylibmc/test.py @@ -7,9 +7,9 @@ # project from ddtrace import Pin -from ddtrace.contrib.pylibmc import TracedClient -from ddtrace.contrib.pylibmc.patch import patch -from ddtrace.contrib.pylibmc.patch import unpatch +from ddtrace.contrib.internal.pylibmc.client import TracedClient +from ddtrace.contrib.internal.pylibmc.patch import patch +from ddtrace.contrib.internal.pylibmc.patch import unpatch from ddtrace.ext import memcached from tests.contrib.config import MEMCACHED_CONFIG as cfg from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/pylibmc/test_pylibmc_patch.py b/tests/contrib/pylibmc/test_pylibmc_patch.py index 1ca3c413827..5c4a94ac76f 100644 --- a/tests/contrib/pylibmc/test_pylibmc_patch.py +++ b/tests/contrib/pylibmc/test_pylibmc_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pylibmc import get_version -from ddtrace.contrib.pylibmc.patch import patch +from ddtrace.contrib.internal.pylibmc.patch import get_version +from ddtrace.contrib.internal.pylibmc.patch import patch try: - from ddtrace.contrib.pylibmc.patch import unpatch + from ddtrace.contrib.internal.pylibmc.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pymemcache/test_client.py b/tests/contrib/pymemcache/test_client.py index 66f4637e15a..31149d252a2 100644 --- a/tests/contrib/pymemcache/test_client.py +++ b/tests/contrib/pymemcache/test_client.py @@ -11,9 +11,9 @@ # project from ddtrace import Pin +from ddtrace.contrib.internal.pymemcache.patch import patch +from ddtrace.contrib.internal.pymemcache.patch import unpatch from ddtrace.contrib.pymemcache.client import WrappedClient -from ddtrace.contrib.pymemcache.patch import patch -from ddtrace.contrib.pymemcache.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import DummyTracer from tests.utils import TracerTestCase diff --git a/tests/contrib/pymemcache/test_client_defaults.py b/tests/contrib/pymemcache/test_client_defaults.py index 550625ced7a..b16414c3c9f 100644 --- a/tests/contrib/pymemcache/test_client_defaults.py +++ b/tests/contrib/pymemcache/test_client_defaults.py @@ -4,8 +4,8 @@ # project from ddtrace import Pin -from ddtrace.contrib.pymemcache.patch import patch -from ddtrace.contrib.pymemcache.patch import unpatch +from ddtrace.contrib.internal.pymemcache.patch import patch +from ddtrace.contrib.internal.pymemcache.patch import unpatch from tests.utils import override_config from .test_client_mixin import TEST_HOST diff --git a/tests/contrib/pymemcache/test_client_mixin.py b/tests/contrib/pymemcache/test_client_mixin.py index ffe2dba5ca6..78162fcf93c 100644 --- a/tests/contrib/pymemcache/test_client_mixin.py +++ b/tests/contrib/pymemcache/test_client_mixin.py @@ -4,8 +4,8 @@ # project from ddtrace import Pin -from ddtrace.contrib.pymemcache.patch import patch -from ddtrace.contrib.pymemcache.patch import unpatch +from ddtrace.contrib.internal.pymemcache.patch import patch +from ddtrace.contrib.internal.pymemcache.patch import unpatch from ddtrace.ext import memcached as memcachedx from ddtrace.ext import net from tests.utils import DummyTracer diff --git a/tests/contrib/pymemcache/test_pymemcache_patch.py b/tests/contrib/pymemcache/test_pymemcache_patch.py index fcedad008c1..10a49f74dd5 100644 --- a/tests/contrib/pymemcache/test_pymemcache_patch.py +++ b/tests/contrib/pymemcache/test_pymemcache_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pymemcache import get_version -from ddtrace.contrib.pymemcache.patch import patch +from ddtrace.contrib.internal.pymemcache.patch import get_version +from ddtrace.contrib.internal.pymemcache.patch import patch try: - from ddtrace.contrib.pymemcache.patch import unpatch + from ddtrace.contrib.internal.pymemcache.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pymongo/test_pymongo_patch.py b/tests/contrib/pymongo/test_pymongo_patch.py index b1c51ea36a3..5e3ac9480ba 100644 --- a/tests/contrib/pymongo/test_pymongo_patch.py +++ b/tests/contrib/pymongo/test_pymongo_patch.py @@ -2,10 +2,10 @@ # script. If you want to make changes to it, you should make sure that you have # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pymongo.patch import get_version -from ddtrace.contrib.pymongo.patch import patch -from ddtrace.contrib.pymongo.patch import pymongo -from ddtrace.contrib.pymongo.patch import unpatch +from ddtrace.contrib.internal.pymongo.patch import get_version +from ddtrace.contrib.internal.pymongo.patch import patch +from ddtrace.contrib.internal.pymongo.patch import pymongo +from ddtrace.contrib.internal.pymongo.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pymysql/test_pymysql.py b/tests/contrib/pymysql/test_pymysql.py index 207ccc1c4ba..b8a11e5afa7 100644 --- a/tests/contrib/pymysql/test_pymysql.py +++ b/tests/contrib/pymysql/test_pymysql.py @@ -2,8 +2,8 @@ import pymysql from ddtrace import Pin -from ddtrace.contrib.pymysql.patch import patch -from ddtrace.contrib.pymysql.patch import unpatch +from ddtrace.contrib.internal.pymysql.patch import patch +from ddtrace.contrib.internal.pymysql.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib import shared_tests from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/pymysql/test_pymysql_patch.py b/tests/contrib/pymysql/test_pymysql_patch.py index cb48bcda3dd..2d6e518a7f8 100644 --- a/tests/contrib/pymysql/test_pymysql_patch.py +++ b/tests/contrib/pymysql/test_pymysql_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pymysql import get_version -from ddtrace.contrib.pymysql.patch import patch +from ddtrace.contrib.internal.pymysql.patch import get_version +from ddtrace.contrib.internal.pymysql.patch import patch try: - from ddtrace.contrib.pymysql.patch import unpatch + from ddtrace.contrib.internal.pymysql.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pynamodb/test_pynamodb.py b/tests/contrib/pynamodb/test_pynamodb.py index 2ba0ab7e5c4..8f474419bc0 100644 --- a/tests/contrib/pynamodb/test_pynamodb.py +++ b/tests/contrib/pynamodb/test_pynamodb.py @@ -5,8 +5,8 @@ import pytest from ddtrace import Pin -from ddtrace.contrib.pynamodb.patch import patch -from ddtrace.contrib.pynamodb.patch import unpatch +from ddtrace.contrib.internal.pynamodb.patch import patch +from ddtrace.contrib.internal.pynamodb.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import TracerTestCase from tests.utils import assert_is_measured diff --git a/tests/contrib/pynamodb/test_pynamodb_patch.py b/tests/contrib/pynamodb/test_pynamodb_patch.py index 36034c9dabc..e2b9cd41b7b 100644 --- a/tests/contrib/pynamodb/test_pynamodb_patch.py +++ b/tests/contrib/pynamodb/test_pynamodb_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pynamodb import get_version -from ddtrace.contrib.pynamodb.patch import patch +from ddtrace.contrib.internal.pynamodb.patch import get_version +from ddtrace.contrib.internal.pynamodb.patch import patch try: - from ddtrace.contrib.pynamodb.patch import unpatch + from ddtrace.contrib.internal.pynamodb.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pyodbc/test_pyodbc.py b/tests/contrib/pyodbc/test_pyodbc.py index dbbde10187f..8703b0b0391 100644 --- a/tests/contrib/pyodbc/test_pyodbc.py +++ b/tests/contrib/pyodbc/test_pyodbc.py @@ -1,8 +1,8 @@ import pyodbc from ddtrace import Pin -from ddtrace.contrib.pyodbc.patch import patch -from ddtrace.contrib.pyodbc.patch import unpatch +from ddtrace.contrib.internal.pyodbc.patch import patch +from ddtrace.contrib.internal.pyodbc.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import TracerTestCase from tests.utils import assert_is_measured diff --git a/tests/contrib/pyodbc/test_pyodbc_patch.py b/tests/contrib/pyodbc/test_pyodbc_patch.py index 29ad4204d6a..0489828949c 100644 --- a/tests/contrib/pyodbc/test_pyodbc_patch.py +++ b/tests/contrib/pyodbc/test_pyodbc_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pyodbc import get_version -from ddtrace.contrib.pyodbc.patch import patch +from ddtrace.contrib.internal.pyodbc.patch import get_version +from ddtrace.contrib.internal.pyodbc.patch import patch try: - from ddtrace.contrib.pyodbc.patch import unpatch + from ddtrace.contrib.internal.pyodbc.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pyramid/app/web.py b/tests/contrib/pyramid/app/web.py index abf4b20023f..ed77fffc5fb 100644 --- a/tests/contrib/pyramid/app/web.py +++ b/tests/contrib/pyramid/app/web.py @@ -6,7 +6,7 @@ from pyramid.renderers import render_to_response from pyramid.response import Response -from ddtrace.contrib.pyramid import trace_pyramid +from ddtrace.contrib.pyramid.trace import trace_pyramid def create_app(settings, instrument): diff --git a/tests/contrib/pyramid/test_pyramid_patch.py b/tests/contrib/pyramid/test_pyramid_patch.py index 7aec4658e25..aa22e9ed62c 100644 --- a/tests/contrib/pyramid/test_pyramid_patch.py +++ b/tests/contrib/pyramid/test_pyramid_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.pyramid import get_version -from ddtrace.contrib.pyramid.patch import patch +from ddtrace.contrib.internal.pyramid.patch import get_version +from ddtrace.contrib.internal.pyramid.patch import patch try: - from ddtrace.contrib.pyramid.patch import unpatch + from ddtrace.contrib.internal.pyramid.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/pytest/test_pytest.py b/tests/contrib/pytest/test_pytest.py index eeefa59f714..f66513b0060 100644 --- a/tests/contrib/pytest/test_pytest.py +++ b/tests/contrib/pytest/test_pytest.py @@ -9,7 +9,7 @@ import ddtrace from ddtrace.constants import ERROR_MSG from ddtrace.constants import SAMPLING_PRIORITY_KEY -from ddtrace.contrib.pytest import get_version +from ddtrace.contrib.internal.pytest.patch import get_version from ddtrace.contrib.pytest._utils import _USE_PLUGIN_V2 from ddtrace.contrib.pytest.constants import XFAIL_REASON from ddtrace.contrib.pytest.plugin import is_enabled diff --git a/tests/contrib/redis/test_redis.py b/tests/contrib/redis/test_redis.py index f2aa3799b3e..4bd4f896686 100644 --- a/tests/contrib/redis/test_redis.py +++ b/tests/contrib/redis/test_redis.py @@ -6,8 +6,8 @@ import ddtrace from ddtrace import Pin -from ddtrace.contrib.redis.patch import patch -from ddtrace.contrib.redis.patch import unpatch +from ddtrace.contrib.internal.redis.patch import patch +from ddtrace.contrib.internal.redis.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer from tests.utils import DummyTracer diff --git a/tests/contrib/redis/test_redis_asyncio.py b/tests/contrib/redis/test_redis_asyncio.py index fdc5caa13b8..116b0dd2784 100644 --- a/tests/contrib/redis/test_redis_asyncio.py +++ b/tests/contrib/redis/test_redis_asyncio.py @@ -9,8 +9,8 @@ from ddtrace import Pin from ddtrace import tracer -from ddtrace.contrib.redis.patch import patch -from ddtrace.contrib.redis.patch import unpatch +from ddtrace.contrib.internal.redis.patch import patch +from ddtrace.contrib.internal.redis.patch import unpatch from tests.utils import override_config from ..config import REDIS_CONFIG diff --git a/tests/contrib/redis/test_redis_cluster.py b/tests/contrib/redis/test_redis_cluster.py index 455ec9c065d..dcf58c2d00a 100644 --- a/tests/contrib/redis/test_redis_cluster.py +++ b/tests/contrib/redis/test_redis_cluster.py @@ -3,8 +3,8 @@ import redis from ddtrace import Pin -from ddtrace.contrib.redis.patch import patch -from ddtrace.contrib.redis.patch import unpatch +from ddtrace.contrib.internal.redis.patch import patch +from ddtrace.contrib.internal.redis.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer diff --git a/tests/contrib/redis/test_redis_cluster_asyncio.py b/tests/contrib/redis/test_redis_cluster_asyncio.py index c435c582a29..03815073723 100644 --- a/tests/contrib/redis/test_redis_cluster_asyncio.py +++ b/tests/contrib/redis/test_redis_cluster_asyncio.py @@ -3,8 +3,8 @@ import redis from ddtrace import Pin -from ddtrace.contrib.redis.patch import patch -from ddtrace.contrib.redis.patch import unpatch +from ddtrace.contrib.internal.redis.patch import patch +from ddtrace.contrib.internal.redis.patch import unpatch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import assert_is_measured @@ -165,7 +165,7 @@ def test_default_service_name_v1(): import redis from ddtrace import Pin - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer @@ -212,7 +212,7 @@ def test_user_specified_service_v0(): from ddtrace import Pin from ddtrace import config - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer @@ -261,7 +261,7 @@ def test_user_specified_service_v1(): from ddtrace import Pin from ddtrace import config - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer @@ -305,7 +305,7 @@ def test_env_user_specified_rediscluster_service_v0(): import redis from ddtrace import Pin - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer @@ -346,7 +346,7 @@ def test_env_user_specified_rediscluster_service_v1(): import redis from ddtrace import Pin - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer @@ -392,7 +392,7 @@ def test_service_precedence_v0(): from ddtrace import Pin from ddtrace import config - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer @@ -437,7 +437,7 @@ def test_service_precedence_v1(): from ddtrace import Pin from ddtrace import config - from ddtrace.contrib.redis import patch + from ddtrace.contrib.internal.redis.patch import patch from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer from tests.utils import TracerSpanContainer diff --git a/tests/contrib/redis/test_redis_patch.py b/tests/contrib/redis/test_redis_patch.py index e1768baf76b..c3b105d0d9e 100644 --- a/tests/contrib/redis/test_redis_patch.py +++ b/tests/contrib/redis/test_redis_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.redis import get_version -from ddtrace.contrib.redis.patch import patch +from ddtrace.contrib.internal.redis.patch import get_version +from ddtrace.contrib.internal.redis.patch import patch try: - from ddtrace.contrib.redis.patch import unpatch + from ddtrace.contrib.internal.redis.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/rediscluster/test.py b/tests/contrib/rediscluster/test.py index e72f310336f..1ba8881e161 100644 --- a/tests/contrib/rediscluster/test.py +++ b/tests/contrib/rediscluster/test.py @@ -3,9 +3,9 @@ import rediscluster from ddtrace import Pin -from ddtrace.contrib.rediscluster.patch import REDISCLUSTER_VERSION -from ddtrace.contrib.rediscluster.patch import patch -from ddtrace.contrib.rediscluster.patch import unpatch +from ddtrace.contrib.internal.rediscluster.patch import REDISCLUSTER_VERSION +from ddtrace.contrib.internal.rediscluster.patch import patch +from ddtrace.contrib.internal.rediscluster.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.contrib.config import REDISCLUSTER_CONFIG from tests.utils import DummyTracer diff --git a/tests/contrib/rediscluster/test_rediscluster_patch.py b/tests/contrib/rediscluster/test_rediscluster_patch.py index c95dbf73e7c..733892740a5 100644 --- a/tests/contrib/rediscluster/test_rediscluster_patch.py +++ b/tests/contrib/rediscluster/test_rediscluster_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.rediscluster import get_version -from ddtrace.contrib.rediscluster.patch import patch +from ddtrace.contrib.internal.rediscluster.patch import get_version +from ddtrace.contrib.internal.rediscluster.patch import patch try: - from ddtrace.contrib.rediscluster.patch import unpatch + from ddtrace.contrib.internal.rediscluster.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/requests/test_requests.py b/tests/contrib/requests/test_requests.py index ba78c0a4747..1b572abec17 100644 --- a/tests/contrib/requests/test_requests.py +++ b/tests/contrib/requests/test_requests.py @@ -13,8 +13,8 @@ from ddtrace.constants import ERROR_TYPE from ddtrace.contrib.internal.requests.connection import _extract_hostname_and_path from ddtrace.contrib.internal.requests.connection import _extract_query_string -from ddtrace.contrib.requests import patch -from ddtrace.contrib.requests import unpatch +from ddtrace.contrib.internal.requests.patch import patch +from ddtrace.contrib.internal.requests.patch import unpatch from ddtrace.ext import http from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer @@ -589,7 +589,7 @@ def test_traced_session_no_patch_all(tmpdir): """ import mock import ddtrace -from ddtrace.contrib.requests import TracedSession +from ddtrace.contrib.internal.requests.session import TracedSession # disable tracer writing to agent # FIXME: Remove use of this internal attribute of Tracer to disable writer diff --git a/tests/contrib/requests/test_requests_patch.py b/tests/contrib/requests/test_requests_patch.py index d6824627405..abe1dc262d5 100644 --- a/tests/contrib/requests/test_requests_patch.py +++ b/tests/contrib/requests/test_requests_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.requests import get_version -from ddtrace.contrib.requests.patch import patch +from ddtrace.contrib.internal.requests.patch import get_version +from ddtrace.contrib.internal.requests.patch import patch try: - from ddtrace.contrib.requests.patch import unpatch + from ddtrace.contrib.internal.requests.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/rq/test_rq.py b/tests/contrib/rq/test_rq.py index 395f54597fa..d2efb996227 100644 --- a/tests/contrib/rq/test_rq.py +++ b/tests/contrib/rq/test_rq.py @@ -7,9 +7,9 @@ import rq from ddtrace import Pin -from ddtrace.contrib.rq import get_version -from ddtrace.contrib.rq import patch -from ddtrace.contrib.rq import unpatch +from ddtrace.contrib.internal.rq.patch import get_version +from ddtrace.contrib.internal.rq.patch import patch +from ddtrace.contrib.internal.rq.patch import unpatch from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import override_config from tests.utils import snapshot diff --git a/tests/contrib/sanic/conftest.py b/tests/contrib/sanic/conftest.py index dc701154419..95fd51022f4 100644 --- a/tests/contrib/sanic/conftest.py +++ b/tests/contrib/sanic/conftest.py @@ -1,8 +1,8 @@ import pytest import ddtrace -from ddtrace.contrib.sanic import patch -from ddtrace.contrib.sanic import unpatch +from ddtrace.contrib.internal.sanic.patch import patch +from ddtrace.contrib.internal.sanic.patch import unpatch from tests.utils import DummyTracer diff --git a/tests/contrib/sanic/test_sanic_patch.py b/tests/contrib/sanic/test_sanic_patch.py index 2ef66abf386..25c46d554f8 100644 --- a/tests/contrib/sanic/test_sanic_patch.py +++ b/tests/contrib/sanic/test_sanic_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.sanic import get_version -from ddtrace.contrib.sanic.patch import patch +from ddtrace.contrib.internal.sanic.patch import get_version +from ddtrace.contrib.internal.sanic.patch import patch try: - from ddtrace.contrib.sanic.patch import unpatch + from ddtrace.contrib.internal.sanic.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/selenium/test_selenium_chrome.py b/tests/contrib/selenium/test_selenium_chrome.py index d8b68a8fa53..c8f9c9145c8 100644 --- a/tests/contrib/selenium/test_selenium_chrome.py +++ b/tests/contrib/selenium/test_selenium_chrome.py @@ -184,7 +184,7 @@ def test_selenium_chrome_pytest_unpatch_does_not_record_selenium_tags(_http_serv from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options - from ddtrace.contrib.selenium import unpatch + from ddtrace.contrib.internal.selenium.patch import unpatch def test_selenium_local_unpatch(): unpatch() diff --git a/tests/contrib/snowflake/test_snowflake.py b/tests/contrib/snowflake/test_snowflake.py index e3c158ce405..cdb735fb947 100644 --- a/tests/contrib/snowflake/test_snowflake.py +++ b/tests/contrib/snowflake/test_snowflake.py @@ -8,8 +8,8 @@ from ddtrace import Pin from ddtrace import tracer -from ddtrace.contrib.snowflake import patch -from ddtrace.contrib.snowflake import unpatch +from ddtrace.contrib.internal.snowflake.patch import patch +from ddtrace.contrib.internal.snowflake.patch import unpatch from tests.opentracer.utils import init_tracer from tests.utils import override_config from tests.utils import snapshot diff --git a/tests/contrib/snowflake/test_snowflake_patch.py b/tests/contrib/snowflake/test_snowflake_patch.py index 682e55e95d7..63c8e01c86c 100644 --- a/tests/contrib/snowflake/test_snowflake_patch.py +++ b/tests/contrib/snowflake/test_snowflake_patch.py @@ -1,5 +1,5 @@ -from ddtrace.contrib.snowflake import get_version -from ddtrace.contrib.snowflake import patch +from ddtrace.contrib.internal.snowflake.patch import get_version +from ddtrace.contrib.internal.snowflake.patch import patch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/sqlalchemy/mixins.py b/tests/contrib/sqlalchemy/mixins.py index 4d9300dc897..18b180db2d3 100644 --- a/tests/contrib/sqlalchemy/mixins.py +++ b/tests/contrib/sqlalchemy/mixins.py @@ -8,7 +8,7 @@ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker -from ddtrace.contrib.sqlalchemy import trace_engine +from ddtrace.contrib.internal.sqlalchemy.engine import trace_engine from tests.opentracer.utils import init_tracer diff --git a/tests/contrib/sqlalchemy/test_patch.py b/tests/contrib/sqlalchemy/test_patch.py index d8c4b6ba6d4..f33c4bdd8a5 100644 --- a/tests/contrib/sqlalchemy/test_patch.py +++ b/tests/contrib/sqlalchemy/test_patch.py @@ -2,9 +2,9 @@ from sqlalchemy import text from ddtrace import Pin -from ddtrace.contrib.sqlalchemy import get_version -from ddtrace.contrib.sqlalchemy import patch -from ddtrace.contrib.sqlalchemy import unpatch +from ddtrace.contrib.internal.sqlalchemy.patch import get_version +from ddtrace.contrib.internal.sqlalchemy.patch import patch +from ddtrace.contrib.internal.sqlalchemy.patch import unpatch from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import TracerTestCase from tests.utils import assert_is_measured diff --git a/tests/contrib/sqlite3/test_sqlite3.py b/tests/contrib/sqlite3/test_sqlite3.py index f8e141df3f1..f10452cb8da 100644 --- a/tests/contrib/sqlite3/test_sqlite3.py +++ b/tests/contrib/sqlite3/test_sqlite3.py @@ -17,9 +17,9 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.sqlite3.patch import TracedSQLiteCursor -from ddtrace.contrib.sqlite3.patch import patch -from ddtrace.contrib.sqlite3.patch import unpatch +from ddtrace.contrib.internal.sqlite3.patch import TracedSQLiteCursor +from ddtrace.contrib.internal.sqlite3.patch import patch +from ddtrace.contrib.internal.sqlite3.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.opentracer.utils import init_tracer from tests.utils import TracerTestCase diff --git a/tests/contrib/sqlite3/test_sqlite3_patch.py b/tests/contrib/sqlite3/test_sqlite3_patch.py index 9515011f308..62d4dfde017 100644 --- a/tests/contrib/sqlite3/test_sqlite3_patch.py +++ b/tests/contrib/sqlite3/test_sqlite3_patch.py @@ -10,12 +10,12 @@ except ImportError: pass -from ddtrace.contrib.sqlite3 import get_version -from ddtrace.contrib.sqlite3.patch import patch +from ddtrace.contrib.internal.sqlite3.patch import get_version +from ddtrace.contrib.internal.sqlite3.patch import patch try: - from ddtrace.contrib.sqlite3.patch import unpatch + from ddtrace.contrib.internal.sqlite3.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/starlette/test_starlette.py b/tests/contrib/starlette/test_starlette.py index ff756ff0cc9..7d56c71c3f8 100644 --- a/tests/contrib/starlette/test_starlette.py +++ b/tests/contrib/starlette/test_starlette.py @@ -10,10 +10,10 @@ import ddtrace from ddtrace import Pin from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.sqlalchemy import patch as sql_patch -from ddtrace.contrib.sqlalchemy import unpatch as sql_unpatch -from ddtrace.contrib.starlette import patch as starlette_patch -from ddtrace.contrib.starlette import unpatch as starlette_unpatch +from ddtrace.contrib.internal.sqlalchemy.patch import patch as sql_patch +from ddtrace.contrib.internal.sqlalchemy.patch import unpatch as sql_unpatch +from ddtrace.contrib.internal.starlette.patch import patch as starlette_patch +from ddtrace.contrib.internal.starlette.patch import unpatch as starlette_unpatch from ddtrace.propagation import http as http_propagation from tests.contrib.starlette.app import get_app from tests.utils import DummyTracer diff --git a/tests/contrib/starlette/test_starlette_patch.py b/tests/contrib/starlette/test_starlette_patch.py index 6666ad764a9..1f271ebb811 100644 --- a/tests/contrib/starlette/test_starlette_patch.py +++ b/tests/contrib/starlette/test_starlette_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.starlette import get_version -from ddtrace.contrib.starlette import patch -from ddtrace.contrib.starlette import unpatch +from ddtrace.contrib.internal.starlette.patch import get_version +from ddtrace.contrib.internal.starlette.patch import patch +from ddtrace.contrib.internal.starlette.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/structlog/test_structlog_logging.py b/tests/contrib/structlog/test_structlog_logging.py index 5ef75e9feb4..da37f23be33 100644 --- a/tests/contrib/structlog/test_structlog_logging.py +++ b/tests/contrib/structlog/test_structlog_logging.py @@ -8,8 +8,8 @@ from ddtrace.constants import ENV_KEY from ddtrace.constants import SERVICE_KEY from ddtrace.constants import VERSION_KEY -from ddtrace.contrib.structlog import patch -from ddtrace.contrib.structlog import unpatch +from ddtrace.contrib.internal.structlog.patch import patch +from ddtrace.contrib.internal.structlog.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS from tests.utils import override_global_config @@ -87,8 +87,8 @@ def test_log_trace(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch config.service = "logging" config.env = "global.env" @@ -132,8 +132,8 @@ def test_log_trace_128bit_trace_ids(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch from ddtrace.internal.constants import MAX_UINT_64BITS config.service = "logging" @@ -178,8 +178,8 @@ def test_log_DD_TAGS(): from ddtrace.constants import ENV_KEY from ddtrace.constants import SERVICE_KEY from ddtrace.constants import VERSION_KEY - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch patch() @@ -222,8 +222,8 @@ def test_tuple_processor_list(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch config.service = "logging" config.env = "global.env" @@ -264,8 +264,8 @@ def test_no_configured_processor(): from ddtrace import config from ddtrace import tracer - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch config.service = "logging" config.env = "global.env" @@ -303,8 +303,8 @@ def test_two_loggers_no_duplicates(): """ import structlog - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch patch() @@ -331,8 +331,8 @@ def test_configure_processor(): """ import structlog - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch patch() @@ -360,8 +360,8 @@ def test_consistent_empty_config(): """ import structlog - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch patch() @@ -383,8 +383,8 @@ def test_reset_defaults(): """ import structlog - from ddtrace.contrib.structlog import patch - from ddtrace.contrib.structlog import unpatch + from ddtrace.contrib.internal.structlog.patch import patch + from ddtrace.contrib.internal.structlog.patch import unpatch patch() diff --git a/tests/contrib/structlog/test_structlog_patch.py b/tests/contrib/structlog/test_structlog_patch.py index dcfedfecf2d..c7c0ce7ca48 100644 --- a/tests/contrib/structlog/test_structlog_patch.py +++ b/tests/contrib/structlog/test_structlog_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.structlog import get_version -from ddtrace.contrib.structlog.patch import patch +from ddtrace.contrib.internal.structlog.patch import get_version +from ddtrace.contrib.internal.structlog.patch import patch try: - from ddtrace.contrib.structlog.patch import unpatch + from ddtrace.contrib.internal.structlog.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/subprocess/test_subprocess.py b/tests/contrib/subprocess/test_subprocess.py index d2f15637dd4..bbf536e3fec 100644 --- a/tests/contrib/subprocess/test_subprocess.py +++ b/tests/contrib/subprocess/test_subprocess.py @@ -5,10 +5,10 @@ import pytest from ddtrace import Pin +from ddtrace.contrib.internal.subprocess.patch import SubprocessCmdLine +from ddtrace.contrib.internal.subprocess.patch import patch +from ddtrace.contrib.internal.subprocess.patch import unpatch from ddtrace.contrib.subprocess.constants import COMMANDS -from ddtrace.contrib.subprocess.patch import SubprocessCmdLine -from ddtrace.contrib.subprocess.patch import patch -from ddtrace.contrib.subprocess.patch import unpatch from ddtrace.ext import SpanTypes from ddtrace.internal import core from tests.utils import override_config @@ -220,7 +220,7 @@ def test_fork(tracer): pid = os.fork() if pid == 0: # Exit, otherwise the rest of this process will continue to be pytest - from ddtrace.contrib.coverage import unpatch + from ddtrace.contrib.internal.coverage.patch import unpatch unpatch() import pytest diff --git a/tests/contrib/subprocess/test_subprocess_patch.py b/tests/contrib/subprocess/test_subprocess_patch.py index 96148bcdcbe..57778f798c1 100644 --- a/tests/contrib/subprocess/test_subprocess_patch.py +++ b/tests/contrib/subprocess/test_subprocess_patch.py @@ -1,10 +1,10 @@ -from ddtrace.contrib.subprocess.patch import get_version -from ddtrace.contrib.subprocess.patch import patch +from ddtrace.contrib.internal.subprocess.patch import get_version +from ddtrace.contrib.internal.subprocess.patch import patch from ddtrace.settings.asm import config as asm_config try: - from ddtrace.contrib.subprocess.patch import unpatch + from ddtrace.contrib.internal.subprocess.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/tornado/test_safety.py b/tests/contrib/tornado/test_safety.py index 4aaad2ae9bc..aa2893c7189 100644 --- a/tests/contrib/tornado/test_safety.py +++ b/tests/contrib/tornado/test_safety.py @@ -3,8 +3,8 @@ from tornado import httpclient from tornado.testing import gen_test -from ddtrace.contrib.tornado import patch -from ddtrace.contrib.tornado import unpatch +from ddtrace.contrib.internal.tornado.patch import patch +from ddtrace.contrib.internal.tornado.patch import unpatch from ddtrace.ext import http from . import web diff --git a/tests/contrib/tornado/test_stack_context.py b/tests/contrib/tornado/test_stack_context.py index 68ee876a9bb..5d7035c3df5 100644 --- a/tests/contrib/tornado/test_stack_context.py +++ b/tests/contrib/tornado/test_stack_context.py @@ -2,7 +2,7 @@ import tornado from ddtrace._trace.context import Context -from ddtrace.contrib.tornado import TracerStackContext +from ddtrace.contrib.internal.tornado.stack_context import TracerStackContext from .utils import TornadoTestCase from .web.compat import sleep diff --git a/tests/contrib/tornado/test_tornado_patch.py b/tests/contrib/tornado/test_tornado_patch.py index 0f9963ab532..fbd20ff8a50 100644 --- a/tests/contrib/tornado/test_tornado_patch.py +++ b/tests/contrib/tornado/test_tornado_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.tornado import get_version -from ddtrace.contrib.tornado.patch import patch +from ddtrace.contrib.internal.tornado.patch import get_version +from ddtrace.contrib.internal.tornado.patch import patch try: - from ddtrace.contrib.tornado.patch import unpatch + from ddtrace.contrib.internal.tornado.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/tornado/utils.py b/tests/contrib/tornado/utils.py index 4c21dd7ead1..6db7403caac 100644 --- a/tests/contrib/tornado/utils.py +++ b/tests/contrib/tornado/utils.py @@ -2,10 +2,10 @@ from tornado.testing import AsyncHTTPTestCase -from ddtrace.contrib.futures import patch as patch_futures -from ddtrace.contrib.futures import unpatch as unpatch_futures -from ddtrace.contrib.tornado import patch -from ddtrace.contrib.tornado import unpatch +from ddtrace.contrib.internal.futures.patch import patch as patch_futures +from ddtrace.contrib.internal.futures.patch import unpatch as unpatch_futures +from ddtrace.contrib.internal.tornado.patch import patch +from ddtrace.contrib.internal.tornado.patch import unpatch from tests.utils import TracerTestCase from .web import app diff --git a/tests/contrib/unittest/test_unittest.py b/tests/contrib/unittest/test_unittest.py index b2af61b47d8..1cebad34a85 100644 --- a/tests/contrib/unittest/test_unittest.py +++ b/tests/contrib/unittest/test_unittest.py @@ -7,6 +7,8 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_TYPE from ddtrace.constants import SPAN_KIND +from ddtrace.contrib.internal.unittest.patch import _set_tracer +from ddtrace.contrib.internal.unittest.patch import patch from ddtrace.contrib.unittest.constants import COMPONENT_VALUE from ddtrace.contrib.unittest.constants import FRAMEWORK from ddtrace.contrib.unittest.constants import KIND @@ -14,8 +16,6 @@ from ddtrace.contrib.unittest.constants import SESSION_OPERATION_NAME from ddtrace.contrib.unittest.constants import SUITE_OPERATION_NAME from ddtrace.contrib.unittest.constants import TEST_OPERATION_NAME -from ddtrace.contrib.unittest.patch import _set_tracer -from ddtrace.contrib.unittest.patch import patch from ddtrace.ext import SpanTypes from ddtrace.ext import test from ddtrace.ext.ci import RUNTIME_VERSION diff --git a/tests/contrib/unittest/test_unittest_patch.py b/tests/contrib/unittest/test_unittest_patch.py index ff7e10d2064..ccb8668fa12 100644 --- a/tests/contrib/unittest/test_unittest_patch.py +++ b/tests/contrib/unittest/test_unittest_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.unittest import get_version -from ddtrace.contrib.unittest.patch import patch +from ddtrace.contrib.internal.unittest.patch import get_version +from ddtrace.contrib.internal.unittest.patch import patch try: - from ddtrace.contrib.unittest.patch import unpatch + from ddtrace.contrib.internal.unittest.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/urllib3/test_urllib3.py b/tests/contrib/urllib3/test_urllib3.py index 8aa92a4dfb0..ebf431dbf07 100644 --- a/tests/contrib/urllib3/test_urllib3.py +++ b/tests/contrib/urllib3/test_urllib3.py @@ -7,8 +7,8 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.urllib3 import patch -from ddtrace.contrib.urllib3 import unpatch +from ddtrace.contrib.internal.urllib3.patch import patch +from ddtrace.contrib.internal.urllib3.patch import unpatch from ddtrace.ext import http from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.pin import Pin diff --git a/tests/contrib/urllib3/test_urllib3_patch.py b/tests/contrib/urllib3/test_urllib3_patch.py index ace147d715c..90e82140200 100644 --- a/tests/contrib/urllib3/test_urllib3_patch.py +++ b/tests/contrib/urllib3/test_urllib3_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.urllib3 import get_version -from ddtrace.contrib.urllib3 import patch -from ddtrace.contrib.urllib3 import unpatch +from ddtrace.contrib.internal.urllib3.patch import get_version +from ddtrace.contrib.internal.urllib3.patch import patch +from ddtrace.contrib.internal.urllib3.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/vertexai/conftest.py b/tests/contrib/vertexai/conftest.py index 74ba41d4dee..d048683a5c7 100644 --- a/tests/contrib/vertexai/conftest.py +++ b/tests/contrib/vertexai/conftest.py @@ -2,8 +2,8 @@ from mock import PropertyMock import pytest -from ddtrace.contrib.vertexai import patch -from ddtrace.contrib.vertexai import unpatch +from ddtrace.contrib.internal.vertexai.patch import patch +from ddtrace.contrib.internal.vertexai.patch import unpatch from ddtrace.llmobs import LLMObs from ddtrace.pin import Pin from tests.contrib.vertexai.utils import MockAsyncPredictionServiceClient diff --git a/tests/contrib/vertexai/test_vertexai_patch.py b/tests/contrib/vertexai/test_vertexai_patch.py index 39ae2d599d1..dfadd1ce1f9 100644 --- a/tests/contrib/vertexai/test_vertexai_patch.py +++ b/tests/contrib/vertexai/test_vertexai_patch.py @@ -1,6 +1,6 @@ -from ddtrace.contrib.vertexai import get_version -from ddtrace.contrib.vertexai import patch -from ddtrace.contrib.vertexai import unpatch +from ddtrace.contrib.internal.vertexai.patch import get_version +from ddtrace.contrib.internal.vertexai.patch import patch +from ddtrace.contrib.internal.vertexai.patch import unpatch from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/vertica/test_vertica.py b/tests/contrib/vertica/test_vertica.py index 4752575e0b9..f0c47887f9e 100644 --- a/tests/contrib/vertica/test_vertica.py +++ b/tests/contrib/vertica/test_vertica.py @@ -7,8 +7,8 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.vertica.patch import patch -from ddtrace.contrib.vertica.patch import unpatch +from ddtrace.contrib.internal.vertica.patch import patch +from ddtrace.contrib.internal.vertica.patch import unpatch from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.settings.config import _deepmerge from tests.contrib.config import VERTICA_CONFIG diff --git a/tests/contrib/vertica/test_vertica_patch.py b/tests/contrib/vertica/test_vertica_patch.py index bdaccf5d7e2..234b9de4ef4 100644 --- a/tests/contrib/vertica/test_vertica_patch.py +++ b/tests/contrib/vertica/test_vertica_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.vertica import get_version -from ddtrace.contrib.vertica.patch import patch +from ddtrace.contrib.internal.vertica.patch import get_version +from ddtrace.contrib.internal.vertica.patch import patch try: - from ddtrace.contrib.vertica.patch import unpatch + from ddtrace.contrib.internal.vertica.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/wsgi/test_wsgi.py b/tests/contrib/wsgi/test_wsgi.py index 99f4d4b9a0b..de2b7bb0935 100644 --- a/tests/contrib/wsgi/test_wsgi.py +++ b/tests/contrib/wsgi/test_wsgi.py @@ -4,9 +4,9 @@ from webtest import TestApp from ddtrace import config +from ddtrace.contrib.internal.wsgi.wsgi import DDWSGIMiddleware from ddtrace.contrib.internal.wsgi.wsgi import _DDWSGIMiddlewareBase from ddtrace.contrib.internal.wsgi.wsgi import get_request_headers -from ddtrace.contrib.wsgi import DDWSGIMiddleware from tests.utils import override_config from tests.utils import override_http_config from tests.utils import snapshot @@ -397,7 +397,7 @@ def test_get_request_headers(extra, expected): def test_schematization(ddtrace_run_python_code_in_subprocess, service_name, schema_version): code = """ from webtest import TestApp -from ddtrace.contrib.wsgi import DDWSGIMiddleware +from ddtrace.contrib.internal.wsgi.wsgi import DDWSGIMiddleware from tests.conftest import * from tests.contrib.wsgi.test_wsgi import application diff --git a/tests/contrib/yaaredis/test_yaaredis.py b/tests/contrib/yaaredis/test_yaaredis.py index f80523a72d7..17903e4ec3d 100644 --- a/tests/contrib/yaaredis/test_yaaredis.py +++ b/tests/contrib/yaaredis/test_yaaredis.py @@ -7,8 +7,8 @@ import yaaredis from ddtrace import Pin -from ddtrace.contrib.yaaredis.patch import patch -from ddtrace.contrib.yaaredis.patch import unpatch +from ddtrace.contrib.internal.yaaredis.patch import patch +from ddtrace.contrib.internal.yaaredis.patch import unpatch from tests.opentracer.utils import init_tracer from tests.utils import override_config diff --git a/tests/contrib/yaaredis/test_yaaredis_patch.py b/tests/contrib/yaaredis/test_yaaredis_patch.py index 1d78fe9458c..d93247a1faa 100644 --- a/tests/contrib/yaaredis/test_yaaredis_patch.py +++ b/tests/contrib/yaaredis/test_yaaredis_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.yaaredis import get_version -from ddtrace.contrib.yaaredis.patch import patch +from ddtrace.contrib.internal.yaaredis.patch import get_version +from ddtrace.contrib.internal.yaaredis.patch import patch try: - from ddtrace.contrib.yaaredis.patch import unpatch + from ddtrace.contrib.internal.yaaredis.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/internal/test_module.py b/tests/internal/test_module.py index 885f796af81..dcee4e54462 100644 --- a/tests/internal/test_module.py +++ b/tests/internal/test_module.py @@ -580,7 +580,7 @@ def __getattr__(name): "ddtrace.contrib.trace_utils_redis", # TODO: The following contrib modules are part of the public API (unlike most integrations). # We should consider privatizing the internals of these integrations. - "ddtrace.contrib.unittest.patch", + "ddtrace.contrib.internal.unittest.patch", "ddtrace.contrib.unittest.constants", "ddtrace.contrib.pytest.constants", "ddtrace.contrib.pytest.newhooks", diff --git a/tests/internal/test_serverless.py b/tests/internal/test_serverless.py index 9c896829636..48d7586d25e 100644 --- a/tests/internal/test_serverless.py +++ b/tests/internal/test_serverless.py @@ -116,8 +116,8 @@ def find_spec(self, fullname, *args): sys.meta_path.insert(0, BlockListFinder()) import ddtrace - import ddtrace.contrib.aws_lambda # noqa:F401 - import ddtrace.contrib.psycopg # noqa:F401 + import ddtrace.contrib.internal.aws_lambda # noqa:F401 + import ddtrace.contrib.internal.psycopg # noqa:F401 finally: if isinstance(sys.meta_path[0], BlockListFinder): diff --git a/tests/opentracer/test_tracer_asyncio.py b/tests/opentracer/test_tracer_asyncio.py index 176f2c61fbe..c65ad743ffd 100644 --- a/tests/opentracer/test_tracer_asyncio.py +++ b/tests/opentracer/test_tracer_asyncio.py @@ -3,7 +3,7 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.asyncio import context_provider +from ddtrace.contrib.internal.asyncio import context_provider @pytest.mark.asyncio diff --git a/tests/opentracer/test_tracer_gevent.py b/tests/opentracer/test_tracer_gevent.py index 59a52faaa0e..5aa0466b230 100644 --- a/tests/opentracer/test_tracer_gevent.py +++ b/tests/opentracer/test_tracer_gevent.py @@ -3,8 +3,8 @@ import pytest import ddtrace -from ddtrace.contrib.gevent import patch -from ddtrace.contrib.gevent import unpatch +from ddtrace.contrib.internal.gevent.patch import patch +from ddtrace.contrib.internal.gevent.patch import unpatch @pytest.fixture() diff --git a/tests/tracer/test_correlation_log_context.py b/tests/tracer/test_correlation_log_context.py index 73b21443fbc..51f7cfb07e6 100644 --- a/tests/tracer/test_correlation_log_context.py +++ b/tests/tracer/test_correlation_log_context.py @@ -166,7 +166,7 @@ def test_custom_logging_injection_global_config(): """Ensure custom log injection via get_correlation_log_record returns proper tracer information.""" from ddtrace import tracer from ddtrace._trace.provider import _DD_CONTEXTVAR - from ddtrace.contrib.structlog import patch + from ddtrace.contrib.internal.structlog.patch import patch from tests.tracer.test_correlation_log_context import format_trace_id from tests.tracer.test_correlation_log_context import tracer_injection from tests.utils import override_global_config @@ -200,7 +200,7 @@ def test_custom_logging_injection_global_config(): def test_custom_logging_injection_no_span(): """Ensure custom log injection via get_correlation_log_record with no active span returns empty record.""" from ddtrace._trace.provider import _DD_CONTEXTVAR - from ddtrace.contrib.structlog import patch + from ddtrace.contrib.internal.structlog.patch import patch from tests.tracer.test_correlation_log_context import tracer_injection from tests.utils import override_global_config @@ -232,7 +232,7 @@ def test_custom_logging_injection_no_span(): def test_custom_logging_injection(): """Ensure custom log injection via get_correlation_log_record returns proper active span information.""" from ddtrace import tracer - from ddtrace.contrib.structlog import patch + from ddtrace.contrib.internal.structlog.patch import patch from tests.tracer.test_correlation_log_context import format_trace_id from tests.tracer.test_correlation_log_context import tracer_injection From 96a63c38c2814f425a63fe734f55d7880383b56d Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Tue, 24 Dec 2024 17:06:32 -0500 Subject: [PATCH 02/11] fix ci integrations, gevent, and internal tests --- tests/contrib/pytest/test_pytest.py | 2 +- tests/contrib/rq/test_rq.py | 6 +++--- tests/contrib/unittest/test_unittest.py | 4 ++-- tests/contrib/unittest/test_unittest_patch.py | 6 +++--- tests/internal/test_module.py | 2 +- tests/opentracer/test_tracer_gevent.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/contrib/pytest/test_pytest.py b/tests/contrib/pytest/test_pytest.py index f66513b0060..e688ec1b261 100644 --- a/tests/contrib/pytest/test_pytest.py +++ b/tests/contrib/pytest/test_pytest.py @@ -9,9 +9,9 @@ import ddtrace from ddtrace.constants import ERROR_MSG from ddtrace.constants import SAMPLING_PRIORITY_KEY -from ddtrace.contrib.internal.pytest.patch import get_version from ddtrace.contrib.pytest._utils import _USE_PLUGIN_V2 from ddtrace.contrib.pytest.constants import XFAIL_REASON +from ddtrace.contrib.pytest.patch import get_version from ddtrace.contrib.pytest.plugin import is_enabled from ddtrace.ext import ci from ddtrace.ext import git diff --git a/tests/contrib/rq/test_rq.py b/tests/contrib/rq/test_rq.py index d2efb996227..395f54597fa 100644 --- a/tests/contrib/rq/test_rq.py +++ b/tests/contrib/rq/test_rq.py @@ -7,9 +7,9 @@ import rq from ddtrace import Pin -from ddtrace.contrib.internal.rq.patch import get_version -from ddtrace.contrib.internal.rq.patch import patch -from ddtrace.contrib.internal.rq.patch import unpatch +from ddtrace.contrib.rq import get_version +from ddtrace.contrib.rq import patch +from ddtrace.contrib.rq import unpatch from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import override_config from tests.utils import snapshot diff --git a/tests/contrib/unittest/test_unittest.py b/tests/contrib/unittest/test_unittest.py index 1cebad34a85..b2af61b47d8 100644 --- a/tests/contrib/unittest/test_unittest.py +++ b/tests/contrib/unittest/test_unittest.py @@ -7,8 +7,6 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_TYPE from ddtrace.constants import SPAN_KIND -from ddtrace.contrib.internal.unittest.patch import _set_tracer -from ddtrace.contrib.internal.unittest.patch import patch from ddtrace.contrib.unittest.constants import COMPONENT_VALUE from ddtrace.contrib.unittest.constants import FRAMEWORK from ddtrace.contrib.unittest.constants import KIND @@ -16,6 +14,8 @@ from ddtrace.contrib.unittest.constants import SESSION_OPERATION_NAME from ddtrace.contrib.unittest.constants import SUITE_OPERATION_NAME from ddtrace.contrib.unittest.constants import TEST_OPERATION_NAME +from ddtrace.contrib.unittest.patch import _set_tracer +from ddtrace.contrib.unittest.patch import patch from ddtrace.ext import SpanTypes from ddtrace.ext import test from ddtrace.ext.ci import RUNTIME_VERSION diff --git a/tests/contrib/unittest/test_unittest_patch.py b/tests/contrib/unittest/test_unittest_patch.py index ccb8668fa12..e8996fc573a 100644 --- a/tests/contrib/unittest/test_unittest_patch.py +++ b/tests/contrib/unittest/test_unittest_patch.py @@ -3,12 +3,12 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.internal.unittest.patch import get_version -from ddtrace.contrib.internal.unittest.patch import patch +from ddtrace.contrib.unittest.patch import get_version +from ddtrace.contrib.unittest.patch import patch try: - from ddtrace.contrib.internal.unittest.patch import unpatch + from ddtrace.contrib.unittest.patch import unpatch except ImportError: unpatch = None from tests.contrib.patch import PatchTestCase diff --git a/tests/internal/test_module.py b/tests/internal/test_module.py index dcee4e54462..885f796af81 100644 --- a/tests/internal/test_module.py +++ b/tests/internal/test_module.py @@ -580,7 +580,7 @@ def __getattr__(name): "ddtrace.contrib.trace_utils_redis", # TODO: The following contrib modules are part of the public API (unlike most integrations). # We should consider privatizing the internals of these integrations. - "ddtrace.contrib.internal.unittest.patch", + "ddtrace.contrib.unittest.patch", "ddtrace.contrib.unittest.constants", "ddtrace.contrib.pytest.constants", "ddtrace.contrib.pytest.newhooks", diff --git a/tests/opentracer/test_tracer_gevent.py b/tests/opentracer/test_tracer_gevent.py index 5aa0466b230..d1ca6686e1d 100644 --- a/tests/opentracer/test_tracer_gevent.py +++ b/tests/opentracer/test_tracer_gevent.py @@ -2,9 +2,9 @@ from opentracing.scope_managers.gevent import GeventScopeManager import pytest -import ddtrace from ddtrace.contrib.internal.gevent.patch import patch from ddtrace.contrib.internal.gevent.patch import unpatch +from ddtrace.contrib.internal.gevent.provider import GeventContextProvider @pytest.fixture() @@ -12,7 +12,7 @@ def ot_tracer(ot_tracer_factory): """Fixture providing an opentracer configured for gevent usage.""" # patch gevent patch() - yield ot_tracer_factory("gevent_svc", {}, GeventScopeManager(), ddtrace.contrib.gevent.context_provider) + yield ot_tracer_factory("gevent_svc", {}, GeventScopeManager(), GeventContextProvider()) # unpatch gevent unpatch() From 479646dd9954214e3a306350a7754a8063859d8e Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Thu, 2 Jan 2025 10:54:09 -0500 Subject: [PATCH 03/11] fix tests --- tests/contrib/pytest/test_pytest.py | 2 +- tests/contrib/requests/test_requests.py | 2 +- tests/opentracer/test_tracer_gevent.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/contrib/pytest/test_pytest.py b/tests/contrib/pytest/test_pytest.py index e688ec1b261..eeefa59f714 100644 --- a/tests/contrib/pytest/test_pytest.py +++ b/tests/contrib/pytest/test_pytest.py @@ -9,9 +9,9 @@ import ddtrace from ddtrace.constants import ERROR_MSG from ddtrace.constants import SAMPLING_PRIORITY_KEY +from ddtrace.contrib.pytest import get_version from ddtrace.contrib.pytest._utils import _USE_PLUGIN_V2 from ddtrace.contrib.pytest.constants import XFAIL_REASON -from ddtrace.contrib.pytest.patch import get_version from ddtrace.contrib.pytest.plugin import is_enabled from ddtrace.ext import ci from ddtrace.ext import git diff --git a/tests/contrib/requests/test_requests.py b/tests/contrib/requests/test_requests.py index 1b572abec17..2a892a218f7 100644 --- a/tests/contrib/requests/test_requests.py +++ b/tests/contrib/requests/test_requests.py @@ -589,7 +589,7 @@ def test_traced_session_no_patch_all(tmpdir): """ import mock import ddtrace -from ddtrace.contrib.internal.requests.session import TracedSession +from ddtrace.contrib.requests import TracedSession # disable tracer writing to agent # FIXME: Remove use of this internal attribute of Tracer to disable writer diff --git a/tests/opentracer/test_tracer_gevent.py b/tests/opentracer/test_tracer_gevent.py index d1ca6686e1d..90b22c644d0 100644 --- a/tests/opentracer/test_tracer_gevent.py +++ b/tests/opentracer/test_tracer_gevent.py @@ -2,9 +2,9 @@ from opentracing.scope_managers.gevent import GeventScopeManager import pytest +from ddtrace.contrib.gevent import context_provider from ddtrace.contrib.internal.gevent.patch import patch from ddtrace.contrib.internal.gevent.patch import unpatch -from ddtrace.contrib.internal.gevent.provider import GeventContextProvider @pytest.fixture() @@ -12,7 +12,7 @@ def ot_tracer(ot_tracer_factory): """Fixture providing an opentracer configured for gevent usage.""" # patch gevent patch() - yield ot_tracer_factory("gevent_svc", {}, GeventScopeManager(), GeventContextProvider()) + yield ot_tracer_factory("gevent_svc", {}, GeventScopeManager(), context_provider) # unpatch gevent unpatch() From e6f756156ce71d5f7dbf3f06446665ccf82c90b1 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Thu, 2 Jan 2025 13:17:18 -0500 Subject: [PATCH 04/11] fix asyncio import --- tests/opentracer/test_tracer_asyncio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/opentracer/test_tracer_asyncio.py b/tests/opentracer/test_tracer_asyncio.py index c65ad743ffd..176f2c61fbe 100644 --- a/tests/opentracer/test_tracer_asyncio.py +++ b/tests/opentracer/test_tracer_asyncio.py @@ -3,7 +3,7 @@ import pytest from ddtrace.constants import ERROR_MSG -from ddtrace.contrib.internal.asyncio import context_provider +from ddtrace.contrib.asyncio import context_provider @pytest.mark.asyncio From 1532f1421a9ea96b84a80244995aa1181d7dc106 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Fri, 3 Jan 2025 10:36:17 -0500 Subject: [PATCH 05/11] fix cassandra import --- tests/contrib/cassandra/test_cassandra_patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/contrib/cassandra/test_cassandra_patch.py b/tests/contrib/cassandra/test_cassandra_patch.py index 31921ce1dfa..19a09daccf4 100644 --- a/tests/contrib/cassandra/test_cassandra_patch.py +++ b/tests/contrib/cassandra/test_cassandra_patch.py @@ -3,8 +3,8 @@ # removed the ``_generated`` suffix from the file name, to prevent the content # from being overwritten by future re-generations. -from ddtrace.contrib.internal.cassandra.patch import get_version from ddtrace.contrib.internal.cassandra.patch import patch +from ddtrace.contrib.internal.cassandra.session import get_version try: From c1b8b3743b0c6f17b79160053dc250db9fc22288 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Wed, 8 Jan 2025 12:24:35 -0500 Subject: [PATCH 06/11] make more things internal Co-authored-by: Emmett Butler <723615+emmettbutler@users.noreply.github.com> --- tests/contrib/bottle/test.py | 2 +- tests/contrib/cherrypy/test_middleware.py | 2 +- tests/contrib/pyramid/app/web.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/contrib/bottle/test.py b/tests/contrib/bottle/test.py index abe1d6cd33c..ab0f6db9c8d 100644 --- a/tests/contrib/bottle/test.py +++ b/tests/contrib/bottle/test.py @@ -3,7 +3,7 @@ import ddtrace from ddtrace import config -from ddtrace.contrib.bottle.patch import TracePlugin +from ddtrace.contrib.internal.bottle.patch import TracePlugin from ddtrace.ext import http from ddtrace.internal import compat from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/cherrypy/test_middleware.py b/tests/contrib/cherrypy/test_middleware.py index 9aa03aa94ff..f67f94f2302 100644 --- a/tests/contrib/cherrypy/test_middleware.py +++ b/tests/contrib/cherrypy/test_middleware.py @@ -15,7 +15,7 @@ from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE from ddtrace.constants import SAMPLING_PRIORITY_KEY -from ddtrace.contrib.cherrypy.middleware import TraceMiddleware +from ddtrace.contrib.internal.cherrypy.middleware import TraceMiddleware from ddtrace.ext import http from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import TracerTestCase diff --git a/tests/contrib/pyramid/app/web.py b/tests/contrib/pyramid/app/web.py index ed77fffc5fb..a250a97ce9d 100644 --- a/tests/contrib/pyramid/app/web.py +++ b/tests/contrib/pyramid/app/web.py @@ -6,7 +6,7 @@ from pyramid.renderers import render_to_response from pyramid.response import Response -from ddtrace.contrib.pyramid.trace import trace_pyramid +from ddtrace.contrib.internal.pyramid.trace import trace_pyramid def create_app(settings, instrument): From c3038bdbceb42bce8a73fadb62b91d94823ac73b Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Mon, 13 Jan 2025 16:11:30 -0500 Subject: [PATCH 07/11] fix cherrypy import --- tests/contrib/cherrypy/test_middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/contrib/cherrypy/test_middleware.py b/tests/contrib/cherrypy/test_middleware.py index f67f94f2302..000f15610a0 100644 --- a/tests/contrib/cherrypy/test_middleware.py +++ b/tests/contrib/cherrypy/test_middleware.py @@ -55,7 +55,7 @@ def setUp(self): ) def test_and_emit_get_version(self): - from ddtrace.contrib.internal.cherrypy.patch import get_version + from ddtrace.contrib.internal.cherrypy.middleware import get_version version = get_version() assert type(version) == str From f138ffe34e9247bcf8d6d813cd37f8c3108d54bc Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Mon, 13 Jan 2025 16:14:05 -0500 Subject: [PATCH 08/11] Yuns sugggestions --- tests/contrib/langchain/conftest.py | 4 ++-- tests/contrib/openai/conftest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/contrib/langchain/conftest.py b/tests/contrib/langchain/conftest.py index f280237fc99..f54b040bba7 100644 --- a/tests/contrib/langchain/conftest.py +++ b/tests/contrib/langchain/conftest.py @@ -4,7 +4,7 @@ import pytest from ddtrace import Pin -from ddtrace import patch +from ddtrace.contrib.internal.langchain.patch import patch from ddtrace.contrib.internal.langchain.patch import unpatch from tests.utils import DummyTracer from tests.utils import DummyWriter @@ -91,7 +91,7 @@ def langchain(ddtrace_config_langchain, mock_logs, mock_metrics): AI21_API_KEY=os.getenv("AI21_API_KEY", ""), ) ): - patch(langchain=True) + patch() import langchain mock_logs.reset_mock() diff --git a/tests/contrib/openai/conftest.py b/tests/contrib/openai/conftest.py index fa82d3fcdbc..0d36a5803bf 100644 --- a/tests/contrib/openai/conftest.py +++ b/tests/contrib/openai/conftest.py @@ -8,7 +8,7 @@ import pytest from ddtrace import Pin -from ddtrace import patch +from ddtrace.contrib.internal.openai.patch import patch from ddtrace.contrib.internal.openai.patch import unpatch from ddtrace.filters import TraceFilter from ddtrace.llmobs import LLMObs @@ -165,7 +165,7 @@ def patch_openai(ddtrace_global_config, ddtrace_config_openai, openai_api_key, o if api_key_in_env: openai.api_key = openai_api_key openai.organization = openai_organization - patch(openai=True) + patch() yield unpatch() From 2dd6713d971f5000ce3454b70e7cf06c0ecbb815 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Mon, 13 Jan 2025 23:37:10 -0500 Subject: [PATCH 09/11] find more internal stuff --- ddtrace/appsec/_trace_utils.py | 2 +- ddtrace/internal/datastreams/kombu.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ddtrace/appsec/_trace_utils.py b/ddtrace/appsec/_trace_utils.py index 9f7404d0973..3603c18533c 100644 --- a/ddtrace/appsec/_trace_utils.py +++ b/ddtrace/appsec/_trace_utils.py @@ -304,7 +304,7 @@ def _on_django_login( django_config, ): if user: - from ddtrace.contrib.django.compat import user_is_authenticated + from ddtrace.contrib.internal.django.compat import user_is_authenticated if user_is_authenticated(user): user_id, user_extra = info_retriever.get_user_info( diff --git a/ddtrace/internal/datastreams/kombu.py b/ddtrace/internal/datastreams/kombu.py index 0d163021d52..fd04ebc163a 100644 --- a/ddtrace/internal/datastreams/kombu.py +++ b/ddtrace/internal/datastreams/kombu.py @@ -1,8 +1,8 @@ from ddtrace import config -from ddtrace.contrib.kombu.utils import HEADER_POS -from ddtrace.contrib.kombu.utils import PUBLISH_BODY_IDX -from ddtrace.contrib.kombu.utils import get_exchange_from_args -from ddtrace.contrib.kombu.utils import get_routing_key_from_args +from ddtrace.contrib.internal.kombu.utils import HEADER_POS +from ddtrace.contrib.internal.kombu.utils import PUBLISH_BODY_IDX +from ddtrace.contrib.internal.kombu.utils import get_exchange_from_args +from ddtrace.contrib.internal.kombu.utils import get_routing_key_from_args from ddtrace.internal import core from ddtrace.internal.datastreams.processor import DsmPathwayCodec from ddtrace.internal.datastreams.utils import _calculate_byte_size From c0e940b50b2a6af8c3d087a2582a23c5372033d8 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Mon, 13 Jan 2025 23:51:45 -0500 Subject: [PATCH 10/11] make more things internal --- tests/contrib/aiohttp/app/web.py | 2 +- tests/contrib/aiohttp/conftest.py | 2 +- tests/contrib/aiohttp/test_middleware.py | 6 +++--- tests/contrib/aiohttp/test_request.py | 2 +- tests/contrib/cassandra/test.py | 2 +- tests/contrib/celery/test_utils.py | 10 +++++----- tests/contrib/django/test_django.py | 5 +++-- tests/contrib/django/test_django_utils.py | 2 +- tests/contrib/flask_cache/test.py | 2 +- tests/contrib/flask_cache/test_wrapper_safety.py | 2 +- tests/contrib/grpc/test_constants.py | 2 +- tests/contrib/langchain/test_langchain_patch.py | 4 ++-- tests/contrib/logging/test_logging.py | 4 ++-- tests/contrib/mako/test_mako.py | 2 +- tests/contrib/patch.py | 2 +- tests/contrib/pymemcache/test_client.py | 2 +- tests/contrib/pymongo/test_spec.py | 2 +- tests/contrib/rq/test_rq.py | 6 +++--- tests/contrib/subprocess/test_subprocess.py | 2 +- 19 files changed, 31 insertions(+), 30 deletions(-) diff --git a/tests/contrib/aiohttp/app/web.py b/tests/contrib/aiohttp/app/web.py index e97100e4144..d4eeb9b1646 100644 --- a/tests/contrib/aiohttp/app/web.py +++ b/tests/contrib/aiohttp/app/web.py @@ -11,7 +11,7 @@ else: import jinja2 -from ddtrace.contrib.aiohttp.middlewares import CONFIG_KEY +from ddtrace.contrib.internal.aiohttp.middlewares import CONFIG_KEY BASE_DIR = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/contrib/aiohttp/conftest.py b/tests/contrib/aiohttp/conftest.py index 3855ac22e1f..4166049bd23 100644 --- a/tests/contrib/aiohttp/conftest.py +++ b/tests/contrib/aiohttp/conftest.py @@ -1,7 +1,7 @@ import aiohttp # noqa:F401 import pytest -from ddtrace.contrib.aiohttp.middlewares import trace_app +from ddtrace.contrib.internal.aiohttp.middlewares import trace_app from ddtrace.contrib.internal.aiohttp.patch import unpatch from ddtrace.internal.utils import version # noqa:F401 diff --git a/tests/contrib/aiohttp/test_middleware.py b/tests/contrib/aiohttp/test_middleware.py index fff59e12257..30d40654314 100644 --- a/tests/contrib/aiohttp/test_middleware.py +++ b/tests/contrib/aiohttp/test_middleware.py @@ -7,9 +7,9 @@ from ddtrace.constants import ERROR_MSG from ddtrace.constants import SAMPLING_PRIORITY_KEY from ddtrace.constants import USER_KEEP -from ddtrace.contrib.aiohttp.middlewares import CONFIG_KEY -from ddtrace.contrib.aiohttp.middlewares import trace_app -from ddtrace.contrib.aiohttp.middlewares import trace_middleware +from ddtrace.contrib.internal.aiohttp.middlewares import CONFIG_KEY +from ddtrace.contrib.internal.aiohttp.middlewares import trace_app +from ddtrace.contrib.internal.aiohttp.middlewares import trace_middleware from ddtrace.ext import http from tests.opentracer.utils import init_tracer from tests.utils import assert_span_http_status_code diff --git a/tests/contrib/aiohttp/test_request.py b/tests/contrib/aiohttp/test_request.py index cde0f311521..36e9d8a399a 100644 --- a/tests/contrib/aiohttp/test_request.py +++ b/tests/contrib/aiohttp/test_request.py @@ -3,7 +3,7 @@ from urllib import request from ddtrace import config -from ddtrace.contrib.aiohttp.middlewares import trace_app +from ddtrace.contrib.internal.aiohttp.middlewares import trace_app from tests.utils import assert_is_measured from tests.utils import override_global_config diff --git a/tests/contrib/cassandra/test.py b/tests/contrib/cassandra/test.py index d0fee6e12a6..b6f5664ac72 100644 --- a/tests/contrib/cassandra/test.py +++ b/tests/contrib/cassandra/test.py @@ -13,9 +13,9 @@ from ddtrace import config from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_TYPE -from ddtrace.contrib.cassandra.session import SERVICE from ddtrace.contrib.internal.cassandra.patch import patch from ddtrace.contrib.internal.cassandra.patch import unpatch +from ddtrace.contrib.internal.cassandra.session import SERVICE from ddtrace.ext import cassandra as cassx from ddtrace.ext import net from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/celery/test_utils.py b/tests/contrib/celery/test_utils.py index 3bbeb959ce1..3c9e0f09d16 100644 --- a/tests/contrib/celery/test_utils.py +++ b/tests/contrib/celery/test_utils.py @@ -4,11 +4,11 @@ import pytest from ddtrace._trace.span import Span -from ddtrace.contrib.celery.utils import attach_span -from ddtrace.contrib.celery.utils import detach_span -from ddtrace.contrib.celery.utils import retrieve_span -from ddtrace.contrib.celery.utils import retrieve_task_id -from ddtrace.contrib.celery.utils import set_tags_from_context +from ddtrace.contrib.internal.celery.utils import attach_span +from ddtrace.contrib.internal.celery.utils import detach_span +from ddtrace.contrib.internal.celery.utils import retrieve_span +from ddtrace.contrib.internal.celery.utils import retrieve_task_id +from ddtrace.contrib.internal.celery.utils import set_tags_from_context @pytest.fixture diff --git a/tests/contrib/django/test_django.py b/tests/contrib/django/test_django.py index 2848599235a..7b8a0e18ef7 100644 --- a/tests/contrib/django/test_django.py +++ b/tests/contrib/django/test_django.py @@ -24,9 +24,9 @@ from ddtrace.constants import SAMPLING_PRIORITY_KEY from ddtrace.constants import USER_KEEP from ddtrace.contrib import trace_utils -from ddtrace.contrib.django.utils import get_request_uri from ddtrace.contrib.internal.django.patch import instrument_view from ddtrace.contrib.internal.django.patch import traced_get_response +from ddtrace.contrib.internal.django.utils import get_request_uri from ddtrace.ext import http from ddtrace.ext import user from ddtrace.internal.compat import ensure_text @@ -1888,7 +1888,8 @@ def test_collecting_requests_handles_improperly_configured_error(client, test_sp """ # patch django._patch - django.__init__.py imports patch.py module as _patch with mock.patch( - "ddtrace.contrib.django.utils.user_is_authenticated", side_effect=django.core.exceptions.ImproperlyConfigured + "ddtrace.contrib.internal.django.utils.user_is_authenticated", + side_effect=django.core.exceptions.ImproperlyConfigured, ): # If ImproperlyConfigured error bubbles up, should automatically fail the test. resp = client.get("/") diff --git a/tests/contrib/django/test_django_utils.py b/tests/contrib/django/test_django_utils.py index b6e4b582fb2..6d1f2b9711e 100644 --- a/tests/contrib/django/test_django_utils.py +++ b/tests/contrib/django/test_django_utils.py @@ -1,7 +1,7 @@ from django.test.client import RequestFactory import pytest -from ddtrace.contrib.django.utils import DJANGO22 +from ddtrace.contrib.internal.django.utils import DJANGO22 from ddtrace.contrib.internal.django.utils import _get_request_headers diff --git a/tests/contrib/flask_cache/test.py b/tests/contrib/flask_cache/test.py index cd92a85814f..b7be36a10eb 100644 --- a/tests/contrib/flask_cache/test.py +++ b/tests/contrib/flask_cache/test.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from flask import Flask -from ddtrace.contrib.flask_cache.tracers import CACHE_BACKEND +from ddtrace.contrib.internal.flask_cache.tracers import CACHE_BACKEND from ddtrace.contrib.internal.flask_cache.tracers import get_traced_cache from ddtrace.ext import net from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/flask_cache/test_wrapper_safety.py b/tests/contrib/flask_cache/test_wrapper_safety.py index b8569f93bde..0b98e1e2557 100644 --- a/tests/contrib/flask_cache/test_wrapper_safety.py +++ b/tests/contrib/flask_cache/test_wrapper_safety.py @@ -3,7 +3,7 @@ import pytest from redis.exceptions import ConnectionError -from ddtrace.contrib.flask_cache.tracers import CACHE_BACKEND +from ddtrace.contrib.internal.flask_cache.tracers import CACHE_BACKEND from ddtrace.contrib.internal.flask_cache.tracers import get_traced_cache from ddtrace.ext import net from tests.utils import TracerTestCase diff --git a/tests/contrib/grpc/test_constants.py b/tests/contrib/grpc/test_constants.py index 5c8238ae126..8da5b97172f 100644 --- a/tests/contrib/grpc/test_constants.py +++ b/tests/contrib/grpc/test_constants.py @@ -15,4 +15,4 @@ def test_not_deprecated(): def test_invalid(): with pytest.raises(ImportError): - from ddtrace.contrib.grpc.constants import INVALID_CONSTANT # noqa:F401 + from ddtrace.contrib.internal.grpc.constants import INVALID_CONSTANT # noqa:F401 diff --git a/tests/contrib/langchain/test_langchain_patch.py b/tests/contrib/langchain/test_langchain_patch.py index dafd38d7575..10df4ab60e9 100644 --- a/tests/contrib/langchain/test_langchain_patch.py +++ b/tests/contrib/langchain/test_langchain_patch.py @@ -1,9 +1,9 @@ +from ddtrace.contrib.internal.langchain.constants import text_embedding_models +from ddtrace.contrib.internal.langchain.constants import vectorstore_classes from ddtrace.contrib.internal.langchain.patch import PATCH_LANGCHAIN_V0 from ddtrace.contrib.internal.langchain.patch import get_version from ddtrace.contrib.internal.langchain.patch import patch from ddtrace.contrib.internal.langchain.patch import unpatch -from ddtrace.contrib.langchain.constants import text_embedding_models -from ddtrace.contrib.langchain.constants import vectorstore_classes from tests.contrib.patch import PatchTestCase diff --git a/tests/contrib/logging/test_logging.py b/tests/contrib/logging/test_logging.py index 4983e074e6e..4da09fa45dc 100644 --- a/tests/contrib/logging/test_logging.py +++ b/tests/contrib/logging/test_logging.py @@ -5,10 +5,10 @@ import ddtrace from ddtrace.constants import ENV_KEY from ddtrace.constants import VERSION_KEY +from ddtrace.contrib.internal.logging.constants import RECORD_ATTR_SPAN_ID +from ddtrace.contrib.internal.logging.constants import RECORD_ATTR_TRACE_ID from ddtrace.contrib.internal.logging.patch import patch from ddtrace.contrib.internal.logging.patch import unpatch -from ddtrace.contrib.logging.constants import RECORD_ATTR_SPAN_ID -from ddtrace.contrib.logging.constants import RECORD_ATTR_TRACE_ID from ddtrace.internal.compat import StringIO from ddtrace.internal.constants import MAX_UINT_64BITS from tests.utils import TracerTestCase diff --git a/tests/contrib/mako/test_mako.py b/tests/contrib/mako/test_mako.py index 617097470a5..9acfaf066ae 100644 --- a/tests/contrib/mako/test_mako.py +++ b/tests/contrib/mako/test_mako.py @@ -5,9 +5,9 @@ from mako.template import Template from ddtrace import Pin +from ddtrace.contrib.internal.mako.constants import DEFAULT_TEMPLATE_NAME from ddtrace.contrib.internal.mako.patch import patch from ddtrace.contrib.internal.mako.patch import unpatch -from ddtrace.contrib.mako.constants import DEFAULT_TEMPLATE_NAME from ddtrace.internal.compat import StringIO from ddtrace.internal.compat import to_unicode from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME diff --git a/tests/contrib/patch.py b/tests/contrib/patch.py index 32ccb18d11a..fabf117f40a 100644 --- a/tests/contrib/patch.py +++ b/tests/contrib/patch.py @@ -748,7 +748,7 @@ def patch_wrapper(wrapped, _, args, kwrags): wrap(module.__name__, module.patch.__name__, patch_wrapper) - ModuleWatchdog.register_module_hook("ddtrace.contrib.%s.patch", patch_hook) + ModuleWatchdog.register_module_hook("ddtrace.contrib.internal.%s.patch", patch_hook) sys.stdout.write("O") diff --git a/tests/contrib/pymemcache/test_client.py b/tests/contrib/pymemcache/test_client.py index 31149d252a2..07eba3766ed 100644 --- a/tests/contrib/pymemcache/test_client.py +++ b/tests/contrib/pymemcache/test_client.py @@ -11,9 +11,9 @@ # project from ddtrace import Pin +from ddtrace.contrib.internal.pymemcache.client import WrappedClient from ddtrace.contrib.internal.pymemcache.patch import patch from ddtrace.contrib.internal.pymemcache.patch import unpatch -from ddtrace.contrib.pymemcache.client import WrappedClient from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from tests.utils import DummyTracer from tests.utils import TracerTestCase diff --git a/tests/contrib/pymongo/test_spec.py b/tests/contrib/pymongo/test_spec.py index fe1339e538e..a297dad5b57 100644 --- a/tests/contrib/pymongo/test_spec.py +++ b/tests/contrib/pymongo/test_spec.py @@ -4,7 +4,7 @@ from bson.son import SON -from ddtrace.contrib.pymongo.parse import parse_spec +from ddtrace.contrib.internal.pymongo.parse import parse_spec def test_empty(): diff --git a/tests/contrib/rq/test_rq.py b/tests/contrib/rq/test_rq.py index 395f54597fa..4c9d7fa8d74 100644 --- a/tests/contrib/rq/test_rq.py +++ b/tests/contrib/rq/test_rq.py @@ -7,9 +7,9 @@ import rq from ddtrace import Pin -from ddtrace.contrib.rq import get_version -from ddtrace.contrib.rq import patch -from ddtrace.contrib.rq import unpatch +from ddtrace.contrib.internal.rq import get_version +from ddtrace.contrib.internal.rq import patch +from ddtrace.contrib.internal.rq import unpatch from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import override_config from tests.utils import snapshot diff --git a/tests/contrib/subprocess/test_subprocess.py b/tests/contrib/subprocess/test_subprocess.py index bbf536e3fec..a6ff5a3a9bd 100644 --- a/tests/contrib/subprocess/test_subprocess.py +++ b/tests/contrib/subprocess/test_subprocess.py @@ -5,10 +5,10 @@ import pytest from ddtrace import Pin +from ddtrace.contrib.internal.subprocess.constants import COMMANDS from ddtrace.contrib.internal.subprocess.patch import SubprocessCmdLine from ddtrace.contrib.internal.subprocess.patch import patch from ddtrace.contrib.internal.subprocess.patch import unpatch -from ddtrace.contrib.subprocess.constants import COMMANDS from ddtrace.ext import SpanTypes from ddtrace.internal import core from tests.utils import override_config From c7cd2b7e357205dc89ea6003def76dce5c31315b Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Tue, 14 Jan 2025 00:23:45 -0500 Subject: [PATCH 11/11] revert rq changes --- tests/contrib/rq/test_rq.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/contrib/rq/test_rq.py b/tests/contrib/rq/test_rq.py index 4c9d7fa8d74..395f54597fa 100644 --- a/tests/contrib/rq/test_rq.py +++ b/tests/contrib/rq/test_rq.py @@ -7,9 +7,9 @@ import rq from ddtrace import Pin -from ddtrace.contrib.internal.rq import get_version -from ddtrace.contrib.internal.rq import patch -from ddtrace.contrib.internal.rq import unpatch +from ddtrace.contrib.rq import get_version +from ddtrace.contrib.rq import patch +from ddtrace.contrib.rq import unpatch from tests.contrib.patch import emit_integration_and_version_to_test_agent from tests.utils import override_config from tests.utils import snapshot