From 0bab6dbf66a33b6ec333868763a53a562a5a182f Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 21 Oct 2021 16:50:00 -0700 Subject: [PATCH 1/2] remove mock compat --- requirements-base.txt | 3 -- src/sentry/testutils/cases.py | 4 +- src/sentry/testutils/helpers/features.py | 2 +- src/sentry/testutils/helpers/options.py | 3 +- src/sentry/testutils/helpers/task_runner.py | 3 +- src/sentry/utils/compat/mock.py | 4 -- src/sentry/utils/pytest/sentry.py | 2 +- tests/acceptance/test_create_project.py | 3 +- tests/acceptance/test_issue_details.py | 2 +- tests/acceptance/test_onboarding.py | 3 +- .../acceptance/test_organization_events_v2.py | 2 +- ...st_organization_global_selection_header.py | 2 +- .../test_organization_group_index.py | 2 +- .../test_organization_rate_limits.py | 3 +- tests/acceptance/test_performance_landing.py | 3 +- tests/acceptance/test_performance_overview.py | 3 +- tests/acceptance/test_performance_summary.py | 2 +- .../test_performance_trace_detail.py | 2 +- tests/acceptance/test_performance_trends.py | 2 +- .../test_performance_vital_detail.py | 2 +- .../acceptance/test_project_tags_settings.py | 2 +- .../acceptance/test_transaction_comparison.py | 2 +- tests/integration/tests.py | 3 +- .../lang/javascript/test_plugin.py | 2 +- tests/relay_integration/test_sdk.py | 2 +- tests/sentry/analytics/test_event.py | 2 +- tests/sentry/api/bases/test_endpoint.py | 3 +- tests/sentry/api/bases/test_organization.py | 2 +- tests/sentry/api/bases/test_sentryapps.py | 3 +- tests/sentry/api/endpoints/test_auth_login.py | 3 +- .../sentry/api/endpoints/test_dif_assemble.py | 2 +- .../api/endpoints/test_group_details.py | 4 +- .../test_group_integration_details.py | 2 +- .../api/endpoints/test_group_notes_details.py | 3 +- .../api/endpoints/test_internal_beacon.py | 3 +- ...st_organization_code_mapping_codeowners.py | 3 +- ...test_organization_has_mobile_app_events.py | 3 +- .../test_organization_integration_repos.py | 3 +- ...zation_integration_serverless_functions.py | 3 +- ...est_organization_invite_request_details.py | 3 +- .../test_organization_join_request.py | 3 +- .../test_organization_member_details.py | 3 +- .../test_organization_member_index.py | 3 +- .../test_organization_release_assemble.py | 2 +- .../test_organization_release_details.py | 2 +- .../endpoints/test_organization_releases.py | 2 +- .../test_organization_repositories.py | 3 +- .../test_organization_repository_details.py | 3 +- ...t_organization_request_project_creation.py | 3 +- .../test_organization_sdk_updates.py | 3 +- ...ization_sentry_app_installation_details.py | 3 +- .../api/endpoints/test_project_details.py | 2 +- .../endpoints/test_project_plugin_details.py | 3 +- .../api/endpoints/test_project_plugins.py | 3 +- .../test_project_rule_task_details.py | 2 +- .../test_project_rules_configuration.py | 3 +- .../endpoints/test_project_stacktrace_link.py | 2 +- .../endpoints/test_project_tagkey_details.py | 3 +- ..._project_transaction_threshold_override.py | 3 +- .../endpoints/test_sentry_app_components.py | 3 +- .../api/endpoints/test_sentry_app_details.py | 3 +- .../test_sentry_app_publish_request.py | 3 +- .../sentry/api/endpoints/test_sentry_apps.py | 2 +- .../test_user_authenticator_details.py | 2 +- .../test_user_authenticator_enroll.py | 2 +- .../api/endpoints/test_user_emails_confirm.py | 3 +- .../api/endpoints/test_user_password.py | 3 +- tests/sentry/api/helpers/test_group_index.py | 3 +- tests/sentry/api/serializers/test_group.py | 4 +- .../api/serializers/test_organization.py | 3 +- tests/sentry/api/serializers/test_project.py | 2 +- tests/sentry/api/serializers/test_release.py | 2 +- tests/sentry/api/test_invite_helper.py | 3 +- tests/sentry/attachments/test_redis.py | 2 +- .../auth/providers/github/test_client.py | 3 +- tests/sentry/auth/providers/test_saml2.py | 2 +- tests/sentry/auth/test_access.py | 3 +- tests/sentry/auth/test_helper.py | 2 +- tests/sentry/auth/test_superuser.py | 2 +- tests/sentry/buffer/base/tests.py | 2 +- tests/sentry/buffer/redis/tests.py | 47 +++++++++---------- tests/sentry/charts/test_chartcuterie.py | 3 +- .../data_export/endpoints/test_data_export.py | 3 +- tests/sentry/data_export/test_models.py | 2 +- tests/sentry/data_export/test_tasks.py | 3 +- tests/sentry/db/test_mixin.py | 3 +- tests/sentry/deletions/test_group.py | 2 +- tests/sentry/deletions/test_repository.py | 3 +- .../interfaces/test_stacktrace.py | 3 +- .../event_manager/test_event_manager.py | 2 +- tests/sentry/eventstore/snuba/test_backend.py | 3 +- tests/sentry/eventstore/test_base.py | 2 +- tests/sentry/eventstream/kafka/test_state.py | 3 +- tests/sentry/features/test_helpers.py | 2 +- tests/sentry/features/test_manager.py | 2 +- tests/sentry/identity/test_oauth2.py | 3 +- .../test_organization_incident_details.py | 2 +- .../test_project_alert_rule_details.py | 3 +- .../test_project_alert_rule_index.py | 3 +- .../incidents/endpoints/test_serializers.py | 3 +- tests/sentry/incidents/test_logic.py | 2 +- tests/sentry/incidents/test_models.py | 2 +- .../incidents/test_subscription_processor.py | 2 +- tests/sentry/incidents/test_tasks.py | 2 +- .../integrations/aws_lambda/test_client.py | 3 +- .../aws_lambda/test_integration.py | 2 +- .../integrations/aws_lambda/test_utils.py | 3 +- .../sentry/integrations/github/test_client.py | 3 +- .../integrations/github/test_integration.py | 2 +- .../sentry/integrations/github/test_issues.py | 3 +- .../integrations/github/test_repository.py | 2 +- .../integrations/github/test_webhooks.py | 2 +- .../github_enterprise/test_integration.py | 2 +- .../github_enterprise/test_issues.py | 3 +- .../github_enterprise/test_webhooks.py | 2 +- .../integrations/gitlab/test_integration.py | 2 +- tests/sentry/integrations/jira/test_client.py | 3 +- .../integrations/jira/test_integration.py | 2 +- .../integrations/jira/test_issue_hook.py | 2 +- .../sentry/integrations/jira/test_ui_hook.py | 3 +- .../integrations/jira/test_uninstalled.py | 3 +- .../sentry/integrations/jira/test_webhooks.py | 3 +- .../integrations/jira_server/test_webhooks.py | 3 +- .../msteams/test_action_state_change.py | 2 +- .../integrations/msteams/test_client.py | 2 +- .../integrations/msteams/test_integration.py | 2 +- .../msteams/test_link_identity.py | 2 +- .../integrations/msteams/test_webhook.py | 2 +- .../integrations/pagerduty/test_client.py | 2 +- .../slack/endpoints/test_action.py | 2 +- .../slack/endpoints/test_event.py | 2 +- .../slack/notifications/test_assigned.py | 2 +- .../slack/notifications/test_deploy.py | 3 +- .../slack/notifications/test_issue_alert.py | 4 +- .../test_new_processing_issues.py | 3 +- .../slack/notifications/test_note.py | 3 +- .../slack/notifications/test_regression.py | 3 +- .../slack/notifications/test_resolved.py | 3 +- .../notifications/test_resolved_in_release.py | 3 +- .../slack/notifications/test_unassigned.py | 3 +- .../integrations/slack/test_requests.py | 2 +- tests/sentry/integrations/slack/test_tasks.py | 2 +- .../sentry/integrations/slack/test_unfurl.py | 3 +- tests/sentry/integrations/test_client.py | 2 +- tests/sentry/integrations/test_pipeline.py | 3 +- .../sentry/integrations/test_ticket_rules.py | 2 +- .../integrations/vsts/test_integration.py | 2 +- .../sentry/integrations/vsts/test_provider.py | 2 +- .../sentry/integrations/vsts/test_webhooks.py | 2 +- .../vsts_extension/test_provider.py | 2 +- .../sentry/lang/javascript/test_processor.py | 2 +- tests/sentry/loader/test_browsersdkversion.py | 3 +- tests/sentry/logging/test_handler.py | 2 +- tests/sentry/mail/test_adapter.py | 2 +- .../sentry_app_components/test_preparer.py | 3 +- .../test_creator.py | 2 +- .../test_destroyer.py | 3 +- .../sentry_app_installations/test_creator.py | 3 +- .../test_destroyer.py | 3 +- .../test_installation_notifier.py | 2 +- .../mediators/sentry_apps/test_creator.py | 3 +- .../mediators/sentry_apps/test_destroyer.py | 3 +- .../sentry_apps/test_internal_creator.py | 3 +- tests/sentry/mediators/test_mediator.py | 2 +- .../token_exchange/test_grant_exchanger.py | 2 +- .../token_exchange/test_refresher.py | 3 +- .../token_exchange/test_validator.py | 3 +- tests/sentry/metrics/test_datadog.py | 3 +- tests/sentry/metrics/test_statsd.py | 3 +- tests/sentry/middleware/test_health.py | 3 +- tests/sentry/middleware/test_stats.py | 3 +- tests/sentry/models/test_groupassignee.py | 3 +- tests/sentry/models/test_groupinbox.py | 3 +- tests/sentry/models/test_groupsnooze.py | 2 +- tests/sentry/models/test_monitor.py | 2 +- tests/sentry/models/test_organization.py | 2 +- .../sentry/models/test_organizationmember.py | 2 +- tests/sentry/models/test_recentsearch.py | 2 +- tests/sentry/models/test_release.py | 3 +- tests/sentry/net/test_socket.py | 3 +- .../nodestore/bigtable/backend/tests.py | 2 +- .../sentry/nodestore/django/backend/tests.py | 2 +- tests/sentry/notifications/test_digests.py | 3 +- tests/sentry/options/test_manager.py | 3 +- tests/sentry/options/test_store.py | 2 +- tests/sentry/plugins/bases/issue/tests.py | 3 +- tests/sentry/plugins/bases/test_issue2.py | 3 +- tests/sentry/plugins/helpers/tests.py | 3 +- tests/sentry/quotas/redis/tests.py | 3 +- tests/sentry/receivers/test_releases.py | 2 +- tests/sentry/receivers/test_sentry_apps.py | 3 +- tests/sentry/receivers/test_signals.py | 3 +- tests/sentry/receivers/test_transactions.py | 3 +- .../sentry/rules/actions/test_notify_event.py | 3 +- .../actions/test_notify_event_service.py | 3 +- .../rules/filters/test_age_comparison.py | 2 +- tests/sentry/rules/test_processor.py | 2 +- .../runner/commands/test_killswitches.py | 3 +- tests/sentry/search/test_utils.py | 2 +- tests/sentry/snuba/test_discover.py | 2 +- .../snuba/test_query_subscription_consumer.py | 2 +- tests/sentry/snuba/test_tasks.py | 2 +- tests/sentry/tasks/post_process/tests.py | 2 +- tests/sentry/tasks/process_buffer/tests.py | 3 +- tests/sentry/tasks/test_activity.py | 3 +- tests/sentry/tasks/test_assemble.py | 2 +- .../sentry/tasks/test_auto_resolve_issues.py | 2 +- tests/sentry/tasks/test_beacon.py | 2 +- tests/sentry/tasks/test_check_auth.py | 2 +- .../tasks/test_clear_expired_snoozes.py | 2 +- tests/sentry/tasks/test_commits.py | 3 +- tests/sentry/tasks/test_digests.py | 3 +- .../tasks/test_enqueue_scheduled_jobs.py | 2 +- tests/sentry/tasks/test_groupowner.py | 3 +- .../tasks/test_low_priority_symbolication.py | 2 +- tests/sentry/tasks/test_merge.py | 3 +- tests/sentry/tasks/test_options.py | 2 +- tests/sentry/tasks/test_relay.py | 3 +- tests/sentry/tasks/test_reports.py | 3 +- tests/sentry/tasks/test_sentry_apps.py | 2 +- tests/sentry/tasks/test_servicehooks.py | 3 +- tests/sentry/tasks/test_store.py | 2 +- tests/sentry/tasks/test_symbolication.py | 3 +- .../templatetags/test_sentry_plugins.py | 3 +- tests/sentry/test_constants.py | 3 +- tests/sentry/test_http.py | 2 +- tests/sentry/testutils/helpers/test_faux.py | 2 +- tests/sentry/tsdb/test_base.py | 3 +- .../utils/email/test_message_builder.py | 2 +- tests/sentry/utils/email/test_send_mail.py | 3 +- tests/sentry/utils/http/tests.py | 2 +- tests/sentry/utils/locking/test_lock.py | 2 +- tests/sentry/utils/test_committers.py | 2 +- tests/sentry/utils/test_concurrent.py | 2 +- tests/sentry/utils/test_cursors.py | 2 +- tests/sentry/utils/test_metrics.py | 3 +- tests/sentry/utils/test_redis.py | 3 +- tests/sentry/utils/test_request_cache.py | 3 +- tests/sentry/utils/test_retries.py | 3 +- tests/sentry/utils/test_safe.py | 2 +- tests/sentry/utils/test_snuba.py | 2 +- tests/sentry/utils/test_urllib3_timeout.py | 3 +- tests/sentry/web/api/tests.py | 3 +- tests/sentry/web/frontend/test_auth_login.py | 2 +- tests/sentry/web/frontend/test_auth_oauth2.py | 2 +- .../frontend/test_auth_organization_login.py | 2 +- tests/sentry/web/frontend/test_auth_saml2.py | 3 +- .../sentry/web/frontend/test_js_sdk_loader.py | 3 +- .../frontend/test_mailgun_inbound_webhook.py | 3 +- .../web/frontend/test_msteams_extension.py | 3 +- .../test_organization_auth_settings.py | 3 +- .../web/frontend/test_release_webhook.py | 2 +- .../sentry_plugins/amazon_sqs/test_plugin.py | 3 +- tests/sentry_plugins/github/test_provider.py | 3 +- tests/sentry_plugins/heroku/test_plugin.py | 2 +- tests/sentry_plugins/test_client.py | 3 +- .../snuba/api/endpoints/test_group_details.py | 3 +- .../endpoints/test_organization_eventid.py | 3 +- .../test_organization_events_facets.py | 2 +- .../test_organization_events_meta.py | 3 +- .../test_organization_events_stats.py | 2 +- .../endpoints/test_organization_events_v2.py | 2 +- .../test_organization_group_index.py | 2 +- .../api/endpoints/test_organization_tags.py | 3 +- .../api/endpoints/test_project_group_index.py | 2 +- tests/snuba/api/serializers/test_group.py | 4 +- tests/snuba/eventstream/test_eventstream.py | 2 +- tests/snuba/search/test_backend.py | 2 +- .../snuba/test_query_subscription_consumer.py | 2 +- tests/snuba/tasks/test_unmerge.py | 2 +- tests/snuba/tsdb/test_tsdb_backend.py | 2 +- tests/symbolicator/test_minidump_full.py | 2 +- tests/symbolicator/test_payload_full.py | 2 +- tests/symbolicator/test_unreal_full.py | 2 +- 274 files changed, 428 insertions(+), 312 deletions(-) delete mode 100644 src/sentry/utils/compat/mock.py diff --git a/requirements-base.txt b/requirements-base.txt index fd6f26a3b00cd7..6a1e7c98850749 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -96,9 +96,6 @@ phabricator==0.7.0 # sentry.utils.pytest and sentry.testutils are moved to tests/ selenium==3.141.0 sqlparse==0.2.4 -# We're still using mock in Python 3.6 because it contains a fix to Python issue37972. -# We should be able to fully swap it out for stdlib once we're on 3.8. -mock==4.0.3 # this is already a transitive dependency via structlog, and we started # implicitly relying on it because of that. Can probably be removed with 3.8 diff --git a/src/sentry/testutils/cases.py b/src/sentry/testutils/cases.py index f3a7b2a5033ea8..bdc682aac78c12 100644 --- a/src/sentry/testutils/cases.py +++ b/src/sentry/testutils/cases.py @@ -29,6 +29,8 @@ import time from contextlib import contextmanager from datetime import datetime +from unittest import mock +from unittest.mock import patch from urllib.parse import urlencode from uuid import uuid4 @@ -84,8 +86,6 @@ from sentry.testutils.helpers.datetime import iso_format from sentry.utils import json from sentry.utils.auth import SSO_SESSION_KEY -from sentry.utils.compat import mock -from sentry.utils.compat.mock import patch from sentry.utils.pytest.selenium import Browser from sentry.utils.retries import TimedRetryPolicy from sentry.utils.snuba import _snuba_pool diff --git a/src/sentry/testutils/helpers/features.py b/src/sentry/testutils/helpers/features.py index e6d2bdb829019c..747f227dcd33a9 100644 --- a/src/sentry/testutils/helpers/features.py +++ b/src/sentry/testutils/helpers/features.py @@ -3,10 +3,10 @@ import logging from collections.abc import Mapping from contextlib import contextmanager +from unittest.mock import patch import sentry.features from sentry.features.exceptions import FeatureNotRegistered -from sentry.utils.compat.mock import patch logger = logging.getLogger(__name__) diff --git a/src/sentry/testutils/helpers/options.py b/src/sentry/testutils/helpers/options.py index 3a20082d9fb808..e065475d7cd49d 100644 --- a/src/sentry/testutils/helpers/options.py +++ b/src/sentry/testutils/helpers/options.py @@ -1,11 +1,10 @@ __all__ = ["override_options"] from contextlib import contextmanager +from unittest.mock import patch from django.test.utils import override_settings -from sentry.utils.compat.mock import patch - @contextmanager def override_options(options): diff --git a/src/sentry/testutils/helpers/task_runner.py b/src/sentry/testutils/helpers/task_runner.py index 84a8f0f21feebb..1b37fb047e8161 100644 --- a/src/sentry/testutils/helpers/task_runner.py +++ b/src/sentry/testutils/helpers/task_runner.py @@ -1,12 +1,11 @@ __all__ = ["TaskRunner"] from contextlib import contextmanager +from unittest.mock import patch from celery import current_app from django.conf import settings -from sentry.utils.compat.mock import patch - @contextmanager def TaskRunner(): diff --git a/src/sentry/utils/compat/mock.py b/src/sentry/utils/compat/mock.py deleted file mode 100644 index 45e88a9e781b03..00000000000000 --- a/src/sentry/utils/compat/mock.py +++ /dev/null @@ -1,4 +0,0 @@ -from mock import * # NOQA - -# We're still using mock in Python 3.6 because it contains a fix to Python issue37972. -# We should be able to fully swap it out for stdlib once we're on 3.8. diff --git a/src/sentry/utils/pytest/sentry.py b/src/sentry/utils/pytest/sentry.py index 87629b4ae579ce..bb835e3419685f 100644 --- a/src/sentry/utils/pytest/sentry.py +++ b/src/sentry/utils/pytest/sentry.py @@ -1,10 +1,10 @@ import os from hashlib import md5 +from unittest import mock from django.conf import settings from sentry_sdk import Hub -from sentry.utils.compat import mock from sentry.utils.warnings import UnsupportedBackend TEST_ROOT = os.path.normpath( diff --git a/tests/acceptance/test_create_project.py b/tests/acceptance/test_create_project.py index fded7a8da44bdd..87dcbdddf4c80d 100644 --- a/tests/acceptance/test_create_project.py +++ b/tests/acceptance/test_create_project.py @@ -1,6 +1,7 @@ +from unittest.mock import patch + from sentry.models import Project from sentry.testutils import AcceptanceTestCase -from sentry.utils.compat.mock import patch class CreateProjectTest(AcceptanceTestCase): diff --git a/tests/acceptance/test_issue_details.py b/tests/acceptance/test_issue_details.py index 063c86c20d8fc8..c99dcf98526ec9 100644 --- a/tests/acceptance/test_issue_details.py +++ b/tests/acceptance/test_issue_details.py @@ -1,10 +1,10 @@ from datetime import datetime, timedelta +from unittest.mock import patch import pytz from django.utils import timezone from sentry.testutils import AcceptanceTestCase, SnubaTestCase -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from tests.acceptance.page_objects.issue_details import IssueDetailsPage diff --git a/tests/acceptance/test_onboarding.py b/tests/acceptance/test_onboarding.py index 82694bf716e713..0d15d8906af55a 100644 --- a/tests/acceptance/test_onboarding.py +++ b/tests/acceptance/test_onboarding.py @@ -1,8 +1,9 @@ +from unittest import mock + from selenium.common.exceptions import TimeoutException from sentry.models import Project from sentry.testutils import AcceptanceTestCase -from sentry.utils.compat import mock from sentry.utils.retries import TimedRetryPolicy diff --git a/tests/acceptance/test_organization_events_v2.py b/tests/acceptance/test_organization_events_v2.py index 368ead1899eb7c..c828d12cec5874 100644 --- a/tests/acceptance/test_organization_events_v2.py +++ b/tests/acceptance/test_organization_events_v2.py @@ -1,5 +1,6 @@ import copy from datetime import timedelta +from unittest.mock import patch from urllib.parse import urlencode import pytest @@ -9,7 +10,6 @@ from sentry.discover.models import DiscoverSavedQuery from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format, timestamp_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data FEATURE_NAMES = [ diff --git a/tests/acceptance/test_organization_global_selection_header.py b/tests/acceptance/test_organization_global_selection_header.py index 88e6eeb34b41d9..49757a2728734f 100644 --- a/tests/acceptance/test_organization_global_selection_header.py +++ b/tests/acceptance/test_organization_global_selection_header.py @@ -1,4 +1,5 @@ from datetime import datetime +from unittest.mock import patch import pytest import pytz @@ -6,7 +7,6 @@ from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from tests.acceptance.page_objects.issue_details import IssueDetailsPage from tests.acceptance.page_objects.issue_list import IssueListPage diff --git a/tests/acceptance/test_organization_group_index.py b/tests/acceptance/test_organization_group_index.py index 8215fb973394a1..fa857e6c69cd59 100644 --- a/tests/acceptance/test_organization_group_index.py +++ b/tests/acceptance/test_organization_group_index.py @@ -1,4 +1,5 @@ from datetime import datetime +from unittest.mock import patch import pytz from django.utils import timezone @@ -7,7 +8,6 @@ from sentry.models.groupinbox import add_group_to_inbox from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from tests.acceptance.page_objects.issue_list import IssueListPage event_time = before_now(days=3).replace(tzinfo=pytz.utc) diff --git a/tests/acceptance/test_organization_rate_limits.py b/tests/acceptance/test_organization_rate_limits.py index fe695e6cd498a0..789901d2e6507e 100644 --- a/tests/acceptance/test_organization_rate_limits.py +++ b/tests/acceptance/test_organization_rate_limits.py @@ -1,7 +1,8 @@ +from unittest.mock import Mock, patch + from django.utils import timezone from sentry.testutils import AcceptanceTestCase -from sentry.utils.compat.mock import Mock, patch class OrganizationRateLimitsTest(AcceptanceTestCase): diff --git a/tests/acceptance/test_performance_landing.py b/tests/acceptance/test_performance_landing.py index 50b5e4f827c1dd..a095e1e309597e 100644 --- a/tests/acceptance/test_performance_landing.py +++ b/tests/acceptance/test_performance_landing.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + import pytz from django.db.models import F from sentry.models import Project from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from .page_objects.base import BasePage diff --git a/tests/acceptance/test_performance_overview.py b/tests/acceptance/test_performance_overview.py index 3000b95e24902c..8ac5fdaa762e4f 100644 --- a/tests/acceptance/test_performance_overview.py +++ b/tests/acceptance/test_performance_overview.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + import pytz from django.db.models import F from sentry.models import Project from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from .page_objects.base import BasePage diff --git a/tests/acceptance/test_performance_summary.py b/tests/acceptance/test_performance_summary.py index 68c2c334746ed3..eec49479f6bb46 100644 --- a/tests/acceptance/test_performance_summary.py +++ b/tests/acceptance/test_performance_summary.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import urlencode import pytz @@ -5,7 +6,6 @@ from sentry.models import AssistantActivity from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from .page_objects.transaction_summary import TransactionSummaryPage diff --git a/tests/acceptance/test_performance_trace_detail.py b/tests/acceptance/test_performance_trace_detail.py index eafa76ffa22dee..da25cede2ef9bd 100644 --- a/tests/acceptance/test_performance_trace_detail.py +++ b/tests/acceptance/test_performance_trace_detail.py @@ -1,11 +1,11 @@ from datetime import timedelta +from unittest.mock import patch from uuid import uuid4 import pytz from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data FEATURE_NAMES = ["organizations:performance-view"] diff --git a/tests/acceptance/test_performance_trends.py b/tests/acceptance/test_performance_trends.py index be884b07f8357d..ccf57fbe9486f9 100644 --- a/tests/acceptance/test_performance_trends.py +++ b/tests/acceptance/test_performance_trends.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import urlencode import pytz @@ -6,7 +7,6 @@ from sentry.models import Project from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from .page_objects.base import BasePage diff --git a/tests/acceptance/test_performance_vital_detail.py b/tests/acceptance/test_performance_vital_detail.py index 6b9095a4f11bf3..923b5723a55f12 100644 --- a/tests/acceptance/test_performance_vital_detail.py +++ b/tests/acceptance/test_performance_vital_detail.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import urlencode import pytz @@ -6,7 +7,6 @@ from sentry.models import Project from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from .page_objects.base import BasePage diff --git a/tests/acceptance/test_project_tags_settings.py b/tests/acceptance/test_project_tags_settings.py index 867bb271aad18b..8fec88b614419b 100644 --- a/tests/acceptance/test_project_tags_settings.py +++ b/tests/acceptance/test_project_tags_settings.py @@ -1,10 +1,10 @@ from datetime import datetime +from unittest.mock import patch import pytz from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch event_time = before_now(days=3).replace(tzinfo=pytz.utc) current_time = datetime.utcnow().replace(tzinfo=pytz.utc) diff --git a/tests/acceptance/test_transaction_comparison.py b/tests/acceptance/test_transaction_comparison.py index 3bf53ec561c713..731260169a708c 100644 --- a/tests/acceptance/test_transaction_comparison.py +++ b/tests/acceptance/test_transaction_comparison.py @@ -1,11 +1,11 @@ import copy from datetime import datetime, timedelta +from unittest.mock import patch import pytz from sentry.testutils import AcceptanceTestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, timestamp_format -from sentry.utils.compat.mock import patch from tests.acceptance.test_organization_events_v2 import generate_transaction FEATURE_NAMES = ["organizations:performance-view"] diff --git a/tests/integration/tests.py b/tests/integration/tests.py index e7f3241353c716..00dc69f1b41734 100644 --- a/tests/integration/tests.py +++ b/tests/integration/tests.py @@ -1,7 +1,8 @@ +from unittest import mock + from django.conf import settings from sentry.testutils import TestCase -from sentry.utils.compat import mock from sentry.utils.settings import ConfigurationError, import_string, validate_settings DEPENDENCY_TEST_DATA = { diff --git a/tests/relay_integration/lang/javascript/test_plugin.py b/tests/relay_integration/lang/javascript/test_plugin.py index bf62eb75bba4ef..c35108872767a0 100644 --- a/tests/relay_integration/lang/javascript/test_plugin.py +++ b/tests/relay_integration/lang/javascript/test_plugin.py @@ -2,6 +2,7 @@ import zipfile from base64 import b64encode from io import BytesIO +from unittest.mock import patch import responses from django.utils.encoding import force_bytes @@ -11,7 +12,6 @@ from sentry.testutils import RelayStoreHelper, SnubaTestCase, TransactionTestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat.mock import patch BASE64_SOURCEMAP = "data:application/json;base64," + ( b64encode( diff --git a/tests/relay_integration/test_sdk.py b/tests/relay_integration/test_sdk.py index 7a0de26c4dd799..b118ac8b735dbe 100644 --- a/tests/relay_integration/test_sdk.py +++ b/tests/relay_integration/test_sdk.py @@ -1,4 +1,5 @@ import uuid +from unittest import mock import pytest import sentry_sdk @@ -7,7 +8,6 @@ from sentry import eventstore from sentry.testutils import assert_mock_called_once_with_partial -from sentry.utils.compat import mock from sentry.utils.pytest.relay import adjust_settings_for_relay_tests from sentry.utils.sdk import bind_organization_context, configure_sdk diff --git a/tests/sentry/analytics/test_event.py b/tests/sentry/analytics/test_event.py index 80726255b6bf59..ed3209539f11c0 100644 --- a/tests/sentry/analytics/test_event.py +++ b/tests/sentry/analytics/test_event.py @@ -1,11 +1,11 @@ from datetime import datetime +from unittest.mock import patch import pytest import pytz from sentry.analytics import Attribute, Event, Map from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class ExampleEvent(Event): diff --git a/tests/sentry/api/bases/test_endpoint.py b/tests/sentry/api/bases/test_endpoint.py index 973545a20837e6..1d30e94b7f7b0d 100644 --- a/tests/sentry/api/bases/test_endpoint.py +++ b/tests/sentry/api/bases/test_endpoint.py @@ -1,8 +1,9 @@ +from unittest.mock import Mock + from django.http import QueryDict from sentry.api.base import Endpoint from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock class EndpointTest(TestCase): diff --git a/tests/sentry/api/bases/test_organization.py b/tests/sentry/api/bases/test_organization.py index b874d10e499ba4..87d418190a4f93 100644 --- a/tests/sentry/api/bases/test_organization.py +++ b/tests/sentry/api/bases/test_organization.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest import mock from django.db.models import F from django.test import RequestFactory @@ -14,7 +15,6 @@ from sentry.auth.authenticators import TotpInterface from sentry.models import ApiKey, Organization, OrganizationMember from sentry.testutils import TestCase -from sentry.utils.compat import mock class MockSuperUser: diff --git a/tests/sentry/api/bases/test_sentryapps.py b/tests/sentry/api/bases/test_sentryapps.py index a52e1dd45e514e..ff57efcae10e18 100644 --- a/tests/sentry/api/bases/test_sentryapps.py +++ b/tests/sentry/api/bases/test_sentryapps.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.http import Http404 from sentry.api.bases.sentryapps import ( @@ -9,7 +11,6 @@ ) from sentry.testutils import TestCase from sentry.testutils.helpers.faux import Mock -from sentry.utils.compat.mock import patch class SentryAppPermissionTest(TestCase): diff --git a/tests/sentry/api/endpoints/test_auth_login.py b/tests/sentry/api/endpoints/test_auth_login.py index fd736e1a77a519..e4950674bc77df 100644 --- a/tests/sentry/api/endpoints/test_auth_login.py +++ b/tests/sentry/api/endpoints/test_auth_login.py @@ -1,7 +1,8 @@ +from unittest.mock import patch + from django.urls import reverse from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class AuthLoginEndpointTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_dif_assemble.py b/tests/sentry/api/endpoints/test_dif_assemble.py index 45e6dc74ce4f73..6aee87ca9e1ad0 100644 --- a/tests/sentry/api/endpoints/test_dif_assemble.py +++ b/tests/sentry/api/endpoints/test_dif_assemble.py @@ -1,4 +1,5 @@ from hashlib import sha1 +from unittest.mock import patch from django.core.files.base import ContentFile from django.urls import reverse @@ -14,7 +15,6 @@ set_assemble_status, ) from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class DifAssembleEndpoint(APITestCase): diff --git a/tests/sentry/api/endpoints/test_group_details.py b/tests/sentry/api/endpoints/test_group_details.py index 8625eceb7453b3..51a131127a3cd8 100644 --- a/tests/sentry/api/endpoints/test_group_details.py +++ b/tests/sentry/api/endpoints/test_group_details.py @@ -1,5 +1,7 @@ from base64 import b64encode from datetime import timedelta +from unittest import mock +from unittest.mock import patch from django.utils import timezone @@ -23,8 +25,6 @@ ) from sentry.plugins.base import plugins from sentry.testutils import APITestCase, SnubaTestCase -from sentry.utils.compat import mock -from sentry.utils.compat.mock import patch class GroupDetailsTest(APITestCase, SnubaTestCase): diff --git a/tests/sentry/api/endpoints/test_group_integration_details.py b/tests/sentry/api/endpoints/test_group_integration_details.py index f7a15fd8b59a47..d903b7eded7fac 100644 --- a/tests/sentry/api/endpoints/test_group_integration_details.py +++ b/tests/sentry/api/endpoints/test_group_integration_details.py @@ -1,4 +1,5 @@ import copy +from unittest import mock from sentry.integrations.example.integration import ExampleIntegration from sentry.models import Activity, ExternalIssue, GroupLink, Integration @@ -6,7 +7,6 @@ from sentry.testutils import APITestCase from sentry.testutils.factories import DEFAULT_EVENT_DATA from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock from sentry.utils.http import absolute_uri diff --git a/tests/sentry/api/endpoints/test_group_notes_details.py b/tests/sentry/api/endpoints/test_group_notes_details.py index 7ce11a8b5eaa30..e755f12b2a95fb 100644 --- a/tests/sentry/api/endpoints/test_group_notes_details.py +++ b/tests/sentry/api/endpoints/test_group_notes_details.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + import responses from exam import fixture from sentry.models import Activity, ExternalIssue, Group, GroupLink, Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class GroupNotesDetailsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_internal_beacon.py b/tests/sentry/api/endpoints/test_internal_beacon.py index 9c7a4be8fa6143..972dc10ae6faa3 100644 --- a/tests/sentry/api/endpoints/test_internal_beacon.py +++ b/tests/sentry/api/endpoints/test_internal_beacon.py @@ -1,5 +1,6 @@ +from unittest.mock import patch + from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class InternalBeaconTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_code_mapping_codeowners.py b/tests/sentry/api/endpoints/test_organization_code_mapping_codeowners.py index 5c972ad9fd83bd..7089858b0d1ba9 100644 --- a/tests/sentry/api/endpoints/test_organization_code_mapping_codeowners.py +++ b/tests/sentry/api/endpoints/test_organization_code_mapping_codeowners.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from django.urls import reverse from sentry.models import Integration, Repository from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch GITHUB_CODEOWNER = { "filepath": "CODEOWNERS", diff --git a/tests/sentry/api/endpoints/test_organization_has_mobile_app_events.py b/tests/sentry/api/endpoints/test_organization_has_mobile_app_events.py index 7a3d42e1c19f21..d85465ad690ada 100644 --- a/tests/sentry/api/endpoints/test_organization_has_mobile_app_events.py +++ b/tests/sentry/api/endpoints/test_organization_has_mobile_app_events.py @@ -1,5 +1,6 @@ +from unittest import mock + from sentry.testutils import APITestCase -from sentry.utils.compat import mock from sentry.utils.samples import create_sample_event diff --git a/tests/sentry/api/endpoints/test_organization_integration_repos.py b/tests/sentry/api/endpoints/test_organization_integration_repos.py index d4a0ace08253e8..d1a2b6afe3fc27 100644 --- a/tests/sentry/api/endpoints/test_organization_integration_repos.py +++ b/tests/sentry/api/endpoints/test_organization_integration_repos.py @@ -1,6 +1,7 @@ +from unittest.mock import patch + from sentry.models import Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class OrganizationIntegrationReposTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_integration_serverless_functions.py b/tests/sentry/api/endpoints/test_organization_integration_serverless_functions.py index 4b6b962c20d42a..f6af6f7e430257 100644 --- a/tests/sentry/api/endpoints/test_organization_integration_serverless_functions.py +++ b/tests/sentry/api/endpoints/test_organization_integration_serverless_functions.py @@ -1,8 +1,9 @@ +from unittest.mock import MagicMock, patch + from sentry.integrations.aws_lambda.integration import AwsLambdaIntegration from sentry.models import Integration, ProjectKey from sentry.testutils import APITestCase from sentry.testutils.helpers.faux import Mock -from sentry.utils.compat.mock import MagicMock, patch cloudformation_arn = ( "arn:aws:cloudformation:us-east-2:599817902985:stack/" diff --git a/tests/sentry/api/endpoints/test_organization_invite_request_details.py b/tests/sentry/api/endpoints/test_organization_invite_request_details.py index ead7615df84242..4bb297d18df6d6 100644 --- a/tests/sentry/api/endpoints/test_organization_invite_request_details.py +++ b/tests/sentry/api/endpoints/test_organization_invite_request_details.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from exam import fixture from sentry.models import ( @@ -10,7 +12,6 @@ ) from sentry.testutils import APITestCase from sentry.testutils.helpers import Feature -from sentry.utils.compat.mock import patch class InviteRequestBase(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_join_request.py b/tests/sentry/api/endpoints/test_organization_join_request.py index ef813e0af78c0b..a6764e9ad63770 100644 --- a/tests/sentry/api/endpoints/test_organization_join_request.py +++ b/tests/sentry/api/endpoints/test_organization_join_request.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from django.core import mail from exam import fixture from sentry.models import AuthProvider, InviteStatus, OrganizationMember, OrganizationOption from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class OrganizationJoinRequestTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_member_details.py b/tests/sentry/api/endpoints/test_organization_member_details.py index 4d7041992e07f0..7dddba9449df5b 100644 --- a/tests/sentry/api/endpoints/test_organization_member_details.py +++ b/tests/sentry/api/endpoints/test_organization_member_details.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail from django.db.models import F from django.urls import reverse @@ -14,7 +16,6 @@ ) from sentry.testutils import APITestCase from sentry.utils.compat import map -from sentry.utils.compat.mock import patch class OrganizationMemberTestBase(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_member_index.py b/tests/sentry/api/endpoints/test_organization_member_index.py index 3d89e371b21367..058bae46b19e80 100644 --- a/tests/sentry/api/endpoints/test_organization_member_index.py +++ b/tests/sentry/api/endpoints/test_organization_member_index.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail from django.urls import reverse @@ -12,7 +14,6 @@ ) from sentry.testutils import APITestCase, TestCase from sentry.testutils.helpers import Feature -from sentry.utils.compat.mock import patch class OrganizationMemberSerializerTest(TestCase): diff --git a/tests/sentry/api/endpoints/test_organization_release_assemble.py b/tests/sentry/api/endpoints/test_organization_release_assemble.py index 51e326bc1bedde..c2b35e13d5efbc 100644 --- a/tests/sentry/api/endpoints/test_organization_release_assemble.py +++ b/tests/sentry/api/endpoints/test_organization_release_assemble.py @@ -1,4 +1,5 @@ from hashlib import sha1 +from unittest.mock import patch from django.core.files.base import ContentFile from django.urls import reverse @@ -6,7 +7,6 @@ from sentry.models import ApiToken, FileBlob, FileBlobOwner from sentry.tasks.assemble import ChunkFileState, assemble_artifacts from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class OrganizationReleaseAssembleTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_release_details.py b/tests/sentry/api/endpoints/test_organization_release_details.py index aa2a0269200cff..f1e52576c0ca17 100644 --- a/tests/sentry/api/endpoints/test_organization_release_details.py +++ b/tests/sentry/api/endpoints/test_organization_release_details.py @@ -1,5 +1,6 @@ import unittest from datetime import datetime, timedelta +from unittest.mock import patch import pytz from django.urls import reverse @@ -20,7 +21,6 @@ Repository, ) from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class ReleaseDetailsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_releases.py b/tests/sentry/api/endpoints/test_organization_releases.py index 43552c9cde8e07..a0a375fad48952 100644 --- a/tests/sentry/api/endpoints/test_organization_releases.py +++ b/tests/sentry/api/endpoints/test_organization_releases.py @@ -1,5 +1,6 @@ from base64 import b64encode from datetime import datetime, timedelta +from unittest.mock import patch import pytz from django.urls import reverse @@ -43,7 +44,6 @@ SnubaTestCase, TestCase, ) -from sentry.utils.compat.mock import patch class OrganizationReleaseListTest(APITestCase, SnubaTestCase): diff --git a/tests/sentry/api/endpoints/test_organization_repositories.py b/tests/sentry/api/endpoints/test_organization_repositories.py index 9cacfe0f523bcf..0eb098676d1318 100644 --- a/tests/sentry/api/endpoints/test_organization_repositories.py +++ b/tests/sentry/api/endpoints/test_organization_repositories.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.urls import reverse from sentry.constants import ObjectStatus @@ -5,7 +7,6 @@ from sentry.models import Integration, OrganizationIntegration, Repository from sentry.plugins.providers.dummy.repository import DummyRepositoryProvider from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class OrganizationRepositoriesListTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_repository_details.py b/tests/sentry/api/endpoints/test_organization_repository_details.py index 9918d5a6ec07f0..7c499df9d5632d 100644 --- a/tests/sentry/api/endpoints/test_organization_repository_details.py +++ b/tests/sentry/api/endpoints/test_organization_repository_details.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.urls import reverse from django.utils import timezone @@ -5,7 +7,6 @@ from sentry.models import Commit, Integration, OrganizationOption, Repository, ScheduledDeletion from sentry.testutils import APITestCase from sentry.testutils.helpers import with_feature -from sentry.utils.compat.mock import patch class OrganizationRepositoryDeleteTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_organization_request_project_creation.py b/tests/sentry/api/endpoints/test_organization_request_project_creation.py index 7f6c489ec3c792..a3acffbb8bdbba 100644 --- a/tests/sentry/api/endpoints/test_organization_request_project_creation.py +++ b/tests/sentry/api/endpoints/test_organization_request_project_creation.py @@ -1,5 +1,6 @@ +from unittest import mock + from sentry.testutils import APITestCase -from sentry.utils.compat import mock from sentry.utils.http import absolute_uri diff --git a/tests/sentry/api/endpoints/test_organization_sdk_updates.py b/tests/sentry/api/endpoints/test_organization_sdk_updates.py index d260f38cc8b54e..facaec0a7e99d9 100644 --- a/tests/sentry/api/endpoints/test_organization_sdk_updates.py +++ b/tests/sentry/api/endpoints/test_organization_sdk_updates.py @@ -1,9 +1,10 @@ +from unittest import mock + from django.urls import reverse from sentry.sdk_updates import SdkIndexState from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class OrganizationSdkUpdates(APITestCase, SnubaTestCase): diff --git a/tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py b/tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py index 42d069c698e10c..c75b70351ba322 100644 --- a/tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py +++ b/tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + import responses from django.urls import reverse from sentry.constants import SentryAppInstallationStatus from sentry.mediators.token_exchange import GrantExchanger from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class SentryAppInstallationDetailsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_project_details.py b/tests/sentry/api/endpoints/test_project_details.py index 3cdea633c16c29..8e3c030320c803 100644 --- a/tests/sentry/api/endpoints/test_project_details.py +++ b/tests/sentry/api/endpoints/test_project_details.py @@ -1,4 +1,5 @@ from time import time +from unittest import mock, zip import pytest @@ -31,7 +32,6 @@ from sentry.testutils.helpers import Feature, faux from sentry.types.integrations import ExternalProviders from sentry.utils import json -from sentry.utils.compat import mock, zip def _dyn_sampling_data(): diff --git a/tests/sentry/api/endpoints/test_project_plugin_details.py b/tests/sentry/api/endpoints/test_project_plugin_details.py index f0160ea9cee169..c32069145235cf 100644 --- a/tests/sentry/api/endpoints/test_project_plugin_details.py +++ b/tests/sentry/api/endpoints/test_project_plugin_details.py @@ -1,8 +1,9 @@ +from unittest import mock + from sentry.models import AuditLogEntry, ProjectOption from sentry.plugins.base import plugins from sentry.plugins.bases.notify import NotificationPlugin from sentry.testutils import APITestCase -from sentry.utils.compat import mock class ProjectPluginDetailsTestBase(APITestCase): diff --git a/tests/sentry/api/endpoints/test_project_plugins.py b/tests/sentry/api/endpoints/test_project_plugins.py index 2c6adf833a1cd4..a06ac5414f0d62 100644 --- a/tests/sentry/api/endpoints/test_project_plugins.py +++ b/tests/sentry/api/endpoints/test_project_plugins.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from django.urls import reverse from sentry.plugins.base import plugins from sentry.testutils import APITestCase from sentry.utils.compat import filter -from sentry.utils.compat.mock import patch class ProjectPluginsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_project_rule_task_details.py b/tests/sentry/api/endpoints/test_project_rule_task_details.py index 9ed8b33d6cc1ab..9dd48e17065e82 100644 --- a/tests/sentry/api/endpoints/test_project_rule_task_details.py +++ b/tests/sentry/api/endpoints/test_project_rule_task_details.py @@ -1,9 +1,9 @@ +from unittest.mock import patch from uuid import uuid4 from django.urls import reverse from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class ProjectRuleTaskDetailsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_project_rules_configuration.py b/tests/sentry/api/endpoints/test_project_rules_configuration.py index 8c9e5c782aca9d..6d336a96f1cff9 100644 --- a/tests/sentry/api/endpoints/test_project_rules_configuration.py +++ b/tests/sentry/api/endpoints/test_project_rules_configuration.py @@ -1,6 +1,7 @@ +from unittest.mock import Mock, patch + from sentry.rules.registry import RuleRegistry from sentry.testutils import APITestCase -from sentry.utils.compat.mock import Mock, patch EMAIL_ACTION = "sentry.mail.actions.NotifyEmailAction" APP_ACTION = "sentry.rules.actions.notify_event_service.NotifyEventServiceAction" diff --git a/tests/sentry/api/endpoints/test_project_stacktrace_link.py b/tests/sentry/api/endpoints/test_project_stacktrace_link.py index cc1aa7de53b508..849be232d82e08 100644 --- a/tests/sentry/api/endpoints/test_project_stacktrace_link.py +++ b/tests/sentry/api/endpoints/test_project_stacktrace_link.py @@ -1,9 +1,9 @@ from typing import Any, Mapping +from unittest import mock from sentry.integrations.example.integration import ExampleIntegration from sentry.models import Integration, OrganizationIntegration from sentry.testutils import APITestCase -from sentry.utils.compat import mock def serialized_provider() -> Mapping[str, Any]: diff --git a/tests/sentry/api/endpoints/test_project_tagkey_details.py b/tests/sentry/api/endpoints/test_project_tagkey_details.py index 125997108fcb38..c3e59c4cae6989 100644 --- a/tests/sentry/api/endpoints/test_project_tagkey_details.py +++ b/tests/sentry/api/endpoints/test_project_tagkey_details.py @@ -1,10 +1,11 @@ +from unittest import mock + from django.urls import reverse from sentry import tagstore from sentry.tagstore import TagKeyStatus from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class ProjectTagKeyDetailsTest(APITestCase, SnubaTestCase): diff --git a/tests/sentry/api/endpoints/test_project_transaction_threshold_override.py b/tests/sentry/api/endpoints/test_project_transaction_threshold_override.py index d74df652a03e86..60b074e3910ed9 100644 --- a/tests/sentry/api/endpoints/test_project_transaction_threshold_override.py +++ b/tests/sentry/api/endpoints/test_project_transaction_threshold_override.py @@ -1,3 +1,5 @@ +from unittest import mock + from django.urls import reverse from sentry.models.transaction_threshold import ( @@ -6,7 +8,6 @@ ) from sentry.testutils import APITestCase from sentry.testutils.helpers.datetime import before_now -from sentry.utils.compat import mock from sentry.utils.samples import load_data diff --git a/tests/sentry/api/endpoints/test_sentry_app_components.py b/tests/sentry/api/endpoints/test_sentry_app_components.py index 36f41c21b4a516..a7ff4632dddf0b 100644 --- a/tests/sentry/api/endpoints/test_sentry_app_components.py +++ b/tests/sentry/api/endpoints/test_sentry_app_components.py @@ -1,7 +1,8 @@ +from unittest.mock import call, patch + from sentry.constants import SentryAppInstallationStatus from sentry.coreapi import APIError from sentry.testutils import APITestCase -from sentry.utils.compat.mock import call, patch class SentryAppComponentsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_sentry_app_details.py b/tests/sentry/api/endpoints/test_sentry_app_details.py index a95d6961680066..3395f5e23a3fbc 100644 --- a/tests/sentry/api/endpoints/test_sentry_app_details.py +++ b/tests/sentry/api/endpoints/test_sentry_app_details.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.urls import reverse from sentry.constants import SentryAppStatus @@ -5,7 +7,6 @@ from sentry.testutils import APITestCase from sentry.testutils.helpers import Feature, with_feature from sentry.utils import json -from sentry.utils.compat.mock import patch class SentryAppDetailsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_sentry_app_publish_request.py b/tests/sentry/api/endpoints/test_sentry_app_publish_request.py index c10362b405658b..aee93369b2dfdb 100644 --- a/tests/sentry/api/endpoints/test_sentry_app_publish_request.py +++ b/tests/sentry/api/endpoints/test_sentry_app_publish_request.py @@ -1,8 +1,9 @@ +from unittest import mock + from django.urls import reverse from sentry.constants import SentryAppStatus from sentry.testutils import APITestCase -from sentry.utils.compat import mock class SentryAppPublishRequestTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_sentry_apps.py b/tests/sentry/api/endpoints/test_sentry_apps.py index d8360f38ba2eea..cd6616b8e57a76 100644 --- a/tests/sentry/api/endpoints/test_sentry_apps.py +++ b/tests/sentry/api/endpoints/test_sentry_apps.py @@ -1,4 +1,5 @@ import re +from unittest.mock import patch from django.urls import reverse @@ -15,7 +16,6 @@ from sentry.testutils import APITestCase from sentry.testutils.helpers import Feature, with_feature from sentry.utils import json -from sentry.utils.compat.mock import patch class SentryAppsTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_user_authenticator_details.py b/tests/sentry/api/endpoints/test_user_authenticator_details.py index 47d6d467f4af83..0a7fa06b562394 100644 --- a/tests/sentry/api/endpoints/test_user_authenticator_details.py +++ b/tests/sentry/api/endpoints/test_user_authenticator_details.py @@ -1,4 +1,5 @@ import datetime +from unittest import mock from django.conf import settings from django.core import mail @@ -8,7 +9,6 @@ from sentry.auth.authenticators import RecoveryCodeInterface, SmsInterface, TotpInterface from sentry.models import Authenticator, Organization, User from sentry.testutils import APITestCase -from sentry.utils.compat import mock def get_auth(user: "User") -> Authenticator: diff --git a/tests/sentry/api/endpoints/test_user_authenticator_enroll.py b/tests/sentry/api/endpoints/test_user_authenticator_enroll.py index 954bdd5d6775bc..7d2eebcae7a44d 100644 --- a/tests/sentry/api/endpoints/test_user_authenticator_enroll.py +++ b/tests/sentry/api/endpoints/test_user_authenticator_enroll.py @@ -1,4 +1,5 @@ import os +from unittest import mock from urllib.parse import parse_qsl from django.conf import settings @@ -15,7 +16,6 @@ UserEmail, ) from sentry.testutils import APITestCase -from sentry.utils.compat import mock from tests.sentry.api.endpoints.test_user_authenticator_details import assert_security_email_sent diff --git a/tests/sentry/api/endpoints/test_user_emails_confirm.py b/tests/sentry/api/endpoints/test_user_emails_confirm.py index 3d0a1ee838756f..5f7a43051a0a77 100644 --- a/tests/sentry/api/endpoints/test_user_emails_confirm.py +++ b/tests/sentry/api/endpoints/test_user_emails_confirm.py @@ -1,6 +1,7 @@ +from unittest import mock + from sentry.models import UserEmail from sentry.testutils import APITestCase -from sentry.utils.compat import mock class UserEmailsConfirmTest(APITestCase): diff --git a/tests/sentry/api/endpoints/test_user_password.py b/tests/sentry/api/endpoints/test_user_password.py index 36fc683812685b..58ec3f7449b31d 100644 --- a/tests/sentry/api/endpoints/test_user_password.py +++ b/tests/sentry/api/endpoints/test_user_password.py @@ -1,7 +1,8 @@ +from unittest import mock + from sentry.auth.password_validation import MinimumLengthValidator from sentry.models import User from sentry.testutils import APITestCase -from sentry.utils.compat import mock class UserPasswordTest(APITestCase): diff --git a/tests/sentry/api/helpers/test_group_index.py b/tests/sentry/api/helpers/test_group_index.py index d62e7c320ba3fd..e391cc7b1c83ab 100644 --- a/tests/sentry/api/helpers/test_group_index.py +++ b/tests/sentry/api/helpers/test_group_index.py @@ -1,3 +1,5 @@ +from unittest.mock import Mock, patch + from django.http import QueryDict from sentry.api.helpers.group_index import ( @@ -9,7 +11,6 @@ from sentry.api.issue_search import parse_search_query from sentry.models import GroupInbox, GroupInboxReason, GroupStatus, add_group_to_inbox from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock, patch from sentry.utils.hashlib import md5_text diff --git a/tests/sentry/api/serializers/test_group.py b/tests/sentry/api/serializers/test_group.py index e3f9f864d461b7..cd6c968152507e 100644 --- a/tests/sentry/api/serializers/test_group.py +++ b/tests/sentry/api/serializers/test_group.py @@ -1,4 +1,6 @@ from datetime import timedelta +from unittest import mock +from unittest.mock import patch from django.utils import timezone @@ -18,8 +20,6 @@ from sentry.notifications.types import NotificationSettingOptionValues, NotificationSettingTypes from sentry.testutils import TestCase from sentry.types.integrations import ExternalProviders -from sentry.utils.compat import mock -from sentry.utils.compat.mock import patch class GroupSerializerTest(TestCase): diff --git a/tests/sentry/api/serializers/test_organization.py b/tests/sentry/api/serializers/test_organization.py index 5360462e949606..fdfe138118e638 100644 --- a/tests/sentry/api/serializers/test_organization.py +++ b/tests/sentry/api/serializers/test_organization.py @@ -1,3 +1,5 @@ +from unittest import mock + from django.conf import settings from sentry import features @@ -5,7 +7,6 @@ from sentry.auth import access from sentry.features.base import OrganizationFeature from sentry.testutils import TestCase -from sentry.utils.compat import mock class OrganizationSerializerTest(TestCase): diff --git a/tests/sentry/api/serializers/test_project.py b/tests/sentry/api/serializers/test_project.py index beca2c786f3b41..eb838a5f481d09 100644 --- a/tests/sentry/api/serializers/test_project.py +++ b/tests/sentry/api/serializers/test_project.py @@ -1,5 +1,6 @@ import datetime from datetime import timedelta +from unittest import mock from django.db.models import F from django.utils import timezone @@ -24,7 +25,6 @@ ) from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock from sentry.utils.samples import load_data diff --git a/tests/sentry/api/serializers/test_release.py b/tests/sentry/api/serializers/test_release.py index 3e86425e522557..a217752c88067f 100644 --- a/tests/sentry/api/serializers/test_release.py +++ b/tests/sentry/api/serializers/test_release.py @@ -1,4 +1,5 @@ from datetime import datetime +from unittest.mock import patch from uuid import uuid4 from rest_framework.exceptions import ErrorDetail @@ -22,7 +23,6 @@ ) from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch class ReleaseSerializerTest(TestCase, SnubaTestCase): diff --git a/tests/sentry/api/test_invite_helper.py b/tests/sentry/api/test_invite_helper.py index e551bd8822f1e6..ad926634537762 100644 --- a/tests/sentry/api/test_invite_helper.py +++ b/tests/sentry/api/test_invite_helper.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from django.http import HttpRequest from sentry.api.invite_helper import ApiInviteHelper from sentry.models import AuthProvider, OrganizationMember from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class ApiInviteHelperTest(TestCase): diff --git a/tests/sentry/attachments/test_redis.py b/tests/sentry/attachments/test_redis.py index 5254ea350fee48..0d45db3921578d 100644 --- a/tests/sentry/attachments/test_redis.py +++ b/tests/sentry/attachments/test_redis.py @@ -1,9 +1,9 @@ import zlib +from unittest import mock import pytest from sentry.cache.redis import RbCache, RedisClusterCache -from sentry.utils.compat import mock from sentry.utils.imports import import_string KEY_FMT = "c:1:%s" diff --git a/tests/sentry/auth/providers/github/test_client.py b/tests/sentry/auth/providers/github/test_client.py index 45823606f77d9f..ac205558b7c58f 100644 --- a/tests/sentry/auth/providers/github/test_client.py +++ b/tests/sentry/auth/providers/github/test_client.py @@ -1,9 +1,10 @@ +from unittest import mock + import pytest import responses from sentry.auth.providers.github.client import GitHubClient from sentry.auth.providers.github.constants import API_DOMAIN -from sentry.utils.compat import mock @pytest.fixture diff --git a/tests/sentry/auth/providers/test_saml2.py b/tests/sentry/auth/providers/test_saml2.py index 072334eb9d6400..b328110f3e1c83 100644 --- a/tests/sentry/auth/providers/test_saml2.py +++ b/tests/sentry/auth/providers/test_saml2.py @@ -1,5 +1,6 @@ import types from datetime import datetime +from unittest import mock import pytest from django.utils import timezone @@ -9,7 +10,6 @@ from sentry.auth.providers.saml2.provider import Attributes, SAML2ACSView, SAML2Provider from sentry.models import AuthProvider from sentry.testutils import TestCase -from sentry.utils.compat import mock dummy_provider_config = { "attribute_mapping": { diff --git a/tests/sentry/auth/test_access.py b/tests/sentry/auth/test_access.py index 440a14944c73af..dd5b6af47eda6e 100644 --- a/tests/sentry/auth/test_access.py +++ b/tests/sentry/auth/test_access.py @@ -1,9 +1,10 @@ +from unittest.mock import Mock + from django.contrib.auth.models import AnonymousUser from sentry.auth import access from sentry.models import AuthIdentity, AuthProvider, ObjectStatus, Organization from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock class FromUserTest(TestCase): diff --git a/tests/sentry/auth/test_helper.py b/tests/sentry/auth/test_helper.py index 3aa51cde01adfc..32119bd5d58e57 100644 --- a/tests/sentry/auth/test_helper.py +++ b/tests/sentry/auth/test_helper.py @@ -1,3 +1,4 @@ +from unittest import mock from urllib.parse import urlencode from django.contrib import messages @@ -22,7 +23,6 @@ ) from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat import mock from sentry.utils.redis import clusters diff --git a/tests/sentry/auth/test_superuser.py b/tests/sentry/auth/test_superuser.py index f9b0868ce40c63..1ed3cf63ccf8ea 100644 --- a/tests/sentry/auth/test_superuser.py +++ b/tests/sentry/auth/test_superuser.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import Mock, patch from django.contrib.auth.models import AnonymousUser from django.core import signing @@ -22,7 +23,6 @@ from sentry.models import User from sentry.testutils import TestCase from sentry.utils.auth import mark_sso_complete -from sentry.utils.compat.mock import Mock, patch UNSET = object() diff --git a/tests/sentry/buffer/base/tests.py b/tests/sentry/buffer/base/tests.py index f5c86516e38628..1ef65c2217a82d 100644 --- a/tests/sentry/buffer/base/tests.py +++ b/tests/sentry/buffer/base/tests.py @@ -1,11 +1,11 @@ from datetime import timedelta +from unittest import mock from django.utils import timezone from sentry.buffer.base import Buffer from sentry.models import Group, Organization, Project, Release, ReleaseProject, Team from sentry.testutils import TestCase -from sentry.utils.compat import mock class BufferTest(TestCase): diff --git a/tests/sentry/buffer/redis/tests.py b/tests/sentry/buffer/redis/tests.py index f23c4e81ed95e5..0ae5d26caba24b 100644 --- a/tests/sentry/buffer/redis/tests.py +++ b/tests/sentry/buffer/redis/tests.py @@ -1,5 +1,6 @@ import pickle from datetime import datetime +from unittest import mock from django.utils import timezone from django.utils.encoding import force_text @@ -7,7 +8,6 @@ from sentry.buffer.redis import RedisBuffer from sentry.models import Group, Project from sentry.testutils import TestCase -from sentry.utils.compat import mock class RedisBufferTest(TestCase): @@ -104,7 +104,7 @@ def test_incr_saves_to_redis(self): assert pickle.loads(f) == {"pk": 1, "datetime": now} assert pickle.loads(result.pop("e+datetime")) == now assert pickle.loads(result.pop("e+foo")) == "bar" - assert result == {"i+times_seen": b"1", "m": b"mock.mock.Mock"} + assert result == {"i+times_seen": b"1", "m": b"unittest.mock.Mock"} pending = client.zrange("b:p", 0, -1) assert pending == [b"foo"] @@ -116,7 +116,7 @@ def test_incr_saves_to_redis(self): assert pickle.loads(f) == {"pk": 1, "datetime": now} assert pickle.loads(result.pop("e+datetime")) == now assert pickle.loads(result.pop("e+foo")) == "baz" - assert result == {"i+times_seen": b"2", "m": b"mock.mock.Mock"} + assert result == {"i+times_seen": b"2", "m": b"unittest.mock.Mock"} pending = client.zrange("b:p", 0, -1) assert pending == [b"foo"] @@ -176,30 +176,29 @@ def test_process_uses_signal_only(self, process): { "f": '{"pk": ["i","1"]}', "i+times_seen": "1", - "m": "sentry.utils.compat.mock.Mock", + "m": "unittest.mock.Mock", "s": "1", }, ) self.buf.process("foo") process.assert_called_once_with(mock.Mock, {"times_seen": 1}, {"pk": 1}, {}, True) - """ - @mock.patch("sentry.buffer.redis.RedisBuffer._make_key", mock.Mock(return_value="foo")) - def test_incr_uses_signal_only(self): - now = datetime(2017, 5, 3, 6, 6, 6, tzinfo=timezone.utc) - client = self.buf.cluster.get_routing_client() - model = mock.Mock() - model.__name__ = "Mock" - columns = {"times_seen": 1} - filters = {"pk": 1, "datetime": now} - self.buf.incr(model, columns, filters, extra={"foo": "bar", "datetime": now}, signal_only=True) - result = client.hgetall("foo") - assert result == { - "e+foo": '["s","bar"]', - "e+datetime": '["d","1493791566.000000"]', - "f": '{"pk":["i","1"],"datetime":["d","1493791566.000000"]}', - "i+times_seen": "1", - "m": "mock.mock.Mock", - "s": "1" - } - """ + +# @mock.patch("sentry.buffer.redis.RedisBuffer._make_key", mock.Mock(return_value="foo")) +# def test_incr_uses_signal_only(self): +# now = datetime(2017, 5, 3, 6, 6, 6, tzinfo=timezone.utc) +# client = self.buf.cluster.get_routing_client() +# model = mock.Mock() +# model.__name__ = "Mock" +# columns = {"times_seen": 1} +# filters = {"pk": 1, "datetime": now} +# self.buf.incr(model, columns, filters, extra={"foo": "bar", "datetime": now}, signal_only=True) +# result = client.hgetall("foo") +# assert result == { +# "e+foo": '["s","bar"]', +# "e+datetime": '["d","1493791566.000000"]', +# "f": '{"pk":["i","1"],"datetime":["d","1493791566.000000"]}', +# "i+times_seen": "1", +# "m": "mock.mock.Mock", +# "s": "1" +# } diff --git a/tests/sentry/charts/test_chartcuterie.py b/tests/sentry/charts/test_chartcuterie.py index 259dda04dd1fc6..c468c7a74df6c4 100644 --- a/tests/sentry/charts/test_chartcuterie.py +++ b/tests/sentry/charts/test_chartcuterie.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest import responses from django.urls.base import reverse @@ -6,7 +8,6 @@ from sentry.charts.types import ChartType from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri diff --git a/tests/sentry/data_export/endpoints/test_data_export.py b/tests/sentry/data_export/endpoints/test_data_export.py index 6b722e45101e7a..41f3a8bfa21af6 100644 --- a/tests/sentry/data_export/endpoints/test_data_export.py +++ b/tests/sentry/data_export/endpoints/test_data_export.py @@ -1,10 +1,11 @@ +from unittest import mock + from freezegun import freeze_time from sentry.data_export.base import ExportQueryType, ExportStatus from sentry.data_export.models import ExportedData from sentry.search.utils import parse_datetime_string from sentry.testutils import APITestCase -from sentry.utils.compat import mock from sentry.utils.snuba import MAX_FIELDS diff --git a/tests/sentry/data_export/test_models.py b/tests/sentry/data_export/test_models.py index bb5fd9a6ae6d1d..27feba8834f8ef 100644 --- a/tests/sentry/data_export/test_models.py +++ b/tests/sentry/data_export/test_models.py @@ -1,5 +1,6 @@ import tempfile from datetime import timedelta +from unittest.mock import patch from django.core import mail from django.urls import reverse @@ -10,7 +11,6 @@ from sentry.models import File from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri diff --git a/tests/sentry/data_export/test_tasks.py b/tests/sentry/data_export/test_tasks.py index d901adca00b537..87af53394fe489 100644 --- a/tests/sentry/data_export/test_tasks.py +++ b/tests/sentry/data_export/test_tasks.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.db import IntegrityError from sentry.data_export.base import ExportQueryType @@ -8,7 +10,6 @@ from sentry.search.events.constants import TIMEOUT_ERROR_MESSAGE from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from sentry.utils.snuba import ( DatasetSelectionError, diff --git a/tests/sentry/db/test_mixin.py b/tests/sentry/db/test_mixin.py index 782f26ee145b0f..1d1ef169536550 100644 --- a/tests/sentry/db/test_mixin.py +++ b/tests/sentry/db/test_mixin.py @@ -1,6 +1,7 @@ +from unittest.mock import patch + from sentry.models import OrganizationOption, Repository from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class RenamePendingDeleteTest(TestCase): diff --git a/tests/sentry/deletions/test_group.py b/tests/sentry/deletions/test_group.py index 6a478824865f5c..d53b6b4884aa9b 100644 --- a/tests/sentry/deletions/test_group.py +++ b/tests/sentry/deletions/test_group.py @@ -1,3 +1,4 @@ +from unittest import mock from uuid import uuid4 from sentry import nodestore @@ -16,7 +17,6 @@ from sentry.tasks.deletion import delete_groups from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class DeleteGroupTest(TestCase, SnubaTestCase): diff --git a/tests/sentry/deletions/test_repository.py b/tests/sentry/deletions/test_repository.py index 126455f8ed35af..74b66764a65adc 100644 --- a/tests/sentry/deletions/test_repository.py +++ b/tests/sentry/deletions/test_repository.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail from sentry.constants import ObjectStatus @@ -5,7 +7,6 @@ from sentry.models import Commit, Repository, ScheduledDeletion from sentry.tasks.deletion import run_deletion from sentry.testutils import TransactionTestCase -from sentry.utils.compat.mock import patch class DeleteRepositoryTest(TransactionTestCase): diff --git a/tests/sentry/event_manager/interfaces/test_stacktrace.py b/tests/sentry/event_manager/interfaces/test_stacktrace.py index 9ca6d44f72e771..d829e20ef5e9a7 100644 --- a/tests/sentry/event_manager/interfaces/test_stacktrace.py +++ b/tests/sentry/event_manager/interfaces/test_stacktrace.py @@ -1,9 +1,10 @@ +from unittest import mock + import pytest from sentry import eventstore from sentry.event_manager import EventManager from sentry.interfaces.stacktrace import get_context, is_url -from sentry.utils.compat import mock def test_is_url(): diff --git a/tests/sentry/event_manager/test_event_manager.py b/tests/sentry/event_manager/test_event_manager.py index 1f50fe45526662..2a77957c382967 100644 --- a/tests/sentry/event_manager/test_event_manager.py +++ b/tests/sentry/event_manager/test_event_manager.py @@ -2,6 +2,7 @@ import uuid from datetime import datetime, timedelta from time import time +from unittest import mock import pytest from django.utils import timezone @@ -42,7 +43,6 @@ from sentry.spans.grouping.utils import hash_values from sentry.testutils import TestCase, assert_mock_called_once_with_partial from sentry.utils.cache import cache_key_for_event -from sentry.utils.compat import mock from sentry.utils.outcomes import Outcome diff --git a/tests/sentry/eventstore/snuba/test_backend.py b/tests/sentry/eventstore/snuba/test_backend.py index 37f5d8adab0d22..42ba46044dc54d 100644 --- a/tests/sentry/eventstore/snuba/test_backend.py +++ b/tests/sentry/eventstore/snuba/test_backend.py @@ -1,8 +1,9 @@ +from unittest import mock + from sentry.eventstore.base import Filter from sentry.eventstore.snuba.backend import SnubaEventStorage from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock from sentry.utils.samples import load_data diff --git a/tests/sentry/eventstore/test_base.py b/tests/sentry/eventstore/test_base.py index 47a0ab17bbac36..7e2cbcc494c786 100644 --- a/tests/sentry/eventstore/test_base.py +++ b/tests/sentry/eventstore/test_base.py @@ -1,4 +1,5 @@ import logging +from unittest import mock import pytest @@ -7,7 +8,6 @@ from sentry.eventstore.models import Event from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock from sentry.utils.samples import load_data diff --git a/tests/sentry/eventstream/kafka/test_state.py b/tests/sentry/eventstream/kafka/test_state.py index d89d52f5656a0c..d79691c151ac1e 100644 --- a/tests/sentry/eventstream/kafka/test_state.py +++ b/tests/sentry/eventstream/kafka/test_state.py @@ -1,3 +1,5 @@ +from unittest import mock + import pytest from sentry.eventstream.kafka.state import ( @@ -8,7 +10,6 @@ SynchronizedPartitionState, SynchronizedPartitionStateManager, ) -from sentry.utils.compat import mock def test_transitions(): diff --git a/tests/sentry/features/test_helpers.py b/tests/sentry/features/test_helpers.py index 0d10d081acffdf..821d4b949d0025 100644 --- a/tests/sentry/features/test_helpers.py +++ b/tests/sentry/features/test_helpers.py @@ -1,4 +1,5 @@ from contextlib import contextmanager +from unittest.mock import patch from django.http import HttpRequest from rest_framework.response import Response @@ -7,7 +8,6 @@ from sentry.features import OrganizationFeature from sentry.features.helpers import any_organization_has_feature, requires_feature from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestFeatureHelpers(TestCase): diff --git a/tests/sentry/features/test_manager.py b/tests/sentry/features/test_manager.py index de04a8b87bb245..27096f4d1bab50 100644 --- a/tests/sentry/features/test_manager.py +++ b/tests/sentry/features/test_manager.py @@ -1,4 +1,5 @@ from typing import Any, Mapping, Optional, Union +from unittest import mock from django.conf import settings @@ -6,7 +7,6 @@ from sentry.features import Feature from sentry.models import User from sentry.testutils import TestCase -from sentry.utils.compat import mock class MockBatchHandler(features.BatchFeatureHandler): diff --git a/tests/sentry/identity/test_oauth2.py b/tests/sentry/identity/test_oauth2.py index a8affbef84483e..3827c40434bf14 100644 --- a/tests/sentry/identity/test_oauth2.py +++ b/tests/sentry/identity/test_oauth2.py @@ -1,3 +1,5 @@ +from unittest.mock import Mock + import responses from exam import fixture from requests.exceptions import SSLError @@ -7,7 +9,6 @@ from sentry.identity.pipeline import IdentityProviderPipeline from sentry.identity.providers.dummy import DummyProvider from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock class OAuth2CallbackViewTest(TestCase): diff --git a/tests/sentry/incidents/endpoints/test_organization_incident_details.py b/tests/sentry/incidents/endpoints/test_organization_incident_details.py index 7c4623397e2cab..da3b3da35db55e 100644 --- a/tests/sentry/incidents/endpoints/test_organization_incident_details.py +++ b/tests/sentry/incidents/endpoints/test_organization_incident_details.py @@ -1,4 +1,5 @@ from datetime import datetime +from unittest import mock import pytz from exam import fixture @@ -6,7 +7,6 @@ from sentry.api.serializers import serialize from sentry.incidents.models import Incident, IncidentActivity, IncidentStatus from sentry.testutils import APITestCase -from sentry.utils.compat import mock class BaseIncidentDetailsTest: diff --git a/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py b/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py index bc392cfd0bd3f1..8bbd633820845f 100644 --- a/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py +++ b/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from exam import fixture from sentry.api.serializers import serialize @@ -11,7 +13,6 @@ ) from sentry.models import Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class AlertRuleDetailsBase: diff --git a/tests/sentry/incidents/endpoints/test_project_alert_rule_index.py b/tests/sentry/incidents/endpoints/test_project_alert_rule_index.py index e87f5556a588dd..20fe859690bf66 100644 --- a/tests/sentry/incidents/endpoints/test_project_alert_rule_index.py +++ b/tests/sentry/incidents/endpoints/test_project_alert_rule_index.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytz import requests from exam import fixture @@ -10,7 +12,6 @@ from sentry.testutils import APITestCase from sentry.testutils.helpers.datetime import before_now from sentry.utils import json -from sentry.utils.compat.mock import patch from tests.sentry.api.serializers.test_alert_rule import BaseAlertRuleSerializerTest diff --git a/tests/sentry/incidents/endpoints/test_serializers.py b/tests/sentry/incidents/endpoints/test_serializers.py index ec6bab0c120f87..4f6e6df6626661 100644 --- a/tests/sentry/incidents/endpoints/test_serializers.py +++ b/tests/sentry/incidents/endpoints/test_serializers.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from exam import fixture from rest_framework import serializers @@ -22,7 +24,6 @@ from sentry.snuba.models import QueryDatasets, SnubaQueryEventType from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class TestAlertRuleSerializer(TestCase): diff --git a/tests/sentry/incidents/test_logic.py b/tests/sentry/incidents/test_logic.py index 3002421e853c0b..08a6d8a9ff932c 100644 --- a/tests/sentry/incidents/test_logic.py +++ b/tests/sentry/incidents/test_logic.py @@ -1,6 +1,7 @@ import time import uuid from datetime import datetime, timedelta +from unittest.mock import patch import pytest import pytz @@ -86,7 +87,6 @@ from sentry.testutils import BaseIncidentsTest, SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data diff --git a/tests/sentry/incidents/test_models.py b/tests/sentry/incidents/test_models.py index 72f7711437d475..96daecf48ae892 100644 --- a/tests/sentry/incidents/test_models.py +++ b/tests/sentry/incidents/test_models.py @@ -1,5 +1,6 @@ import unittest from datetime import timedelta +from unittest.mock import Mock, patch from django.core.cache import cache from django.db import IntegrityError, transaction @@ -23,7 +24,6 @@ TriggerStatus, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock, patch class FetchForOrganizationTest(TestCase): diff --git a/tests/sentry/incidents/test_subscription_processor.py b/tests/sentry/incidents/test_subscription_processor.py index 638a92b573d1b7..e7f5140d0529ae 100644 --- a/tests/sentry/incidents/test_subscription_processor.py +++ b/tests/sentry/incidents/test_subscription_processor.py @@ -1,6 +1,7 @@ import unittest from datetime import datetime, timedelta from random import randint +from unittest.mock import Mock, call, patch from uuid import uuid4 import pytz @@ -42,7 +43,6 @@ from sentry.testutils.helpers.datetime import iso_format from sentry.utils import json from sentry.utils.compat import map -from sentry.utils.compat.mock import Mock, call, patch from sentry.utils.dates import to_timestamp EMPTY = object() diff --git a/tests/sentry/incidents/test_tasks.py b/tests/sentry/incidents/test_tasks.py index 0b285999593186..e291435ea5b679 100644 --- a/tests/sentry/incidents/test_tasks.py +++ b/tests/sentry/incidents/test_tasks.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from unittest.mock import Mock, patch from django.urls import reverse from django.utils import timezone @@ -29,7 +30,6 @@ send_subscriber_notifications, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock, patch from sentry.utils.http import absolute_uri diff --git a/tests/sentry/integrations/aws_lambda/test_client.py b/tests/sentry/integrations/aws_lambda/test_client.py index 7c32556de55e55..36651298f725a6 100644 --- a/tests/sentry/integrations/aws_lambda/test_client.py +++ b/tests/sentry/integrations/aws_lambda/test_client.py @@ -1,10 +1,11 @@ +from unittest.mock import MagicMock, patch + import boto3 from sentry.integrations.aws_lambda.client import gen_aws_client from sentry.testutils import TestCase from sentry.testutils.helpers.faux import Mock from sentry.utils import json -from sentry.utils.compat.mock import MagicMock, patch class AwsLambdaClientTest(TestCase): diff --git a/tests/sentry/integrations/aws_lambda/test_integration.py b/tests/sentry/integrations/aws_lambda/test_integration.py index 3bccb774bd6eeb..1510853395eeab 100644 --- a/tests/sentry/integrations/aws_lambda/test_integration.py +++ b/tests/sentry/integrations/aws_lambda/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import ANY, MagicMock, patch from urllib.parse import urlencode from botocore.exceptions import ClientError @@ -11,7 +12,6 @@ from sentry.testutils import IntegrationTestCase from sentry.testutils.helpers.faux import Mock from sentry.utils.compat import map -from sentry.utils.compat.mock import ANY, MagicMock, patch arn = ( "arn:aws:cloudformation:us-east-2:599817902985:stack/" diff --git a/tests/sentry/integrations/aws_lambda/test_utils.py b/tests/sentry/integrations/aws_lambda/test_utils.py index 4cacc7e182407a..61892b9cb7ff5f 100644 --- a/tests/sentry/integrations/aws_lambda/test_utils.py +++ b/tests/sentry/integrations/aws_lambda/test_utils.py @@ -1,3 +1,5 @@ +from unittest.mock import MagicMock, patch + from django.core.cache import cache from django.test import override_settings @@ -17,7 +19,6 @@ from sentry.shared_integrations.exceptions import IntegrationError from sentry.testutils import TestCase from sentry.testutils.helpers.faux import Mock -from sentry.utils.compat.mock import MagicMock, patch class ParseArnTest(TestCase): diff --git a/tests/sentry/integrations/github/test_client.py b/tests/sentry/integrations/github/test_client.py index 766707319525ca..4cefe0725cc044 100644 --- a/tests/sentry/integrations/github/test_client.py +++ b/tests/sentry/integrations/github/test_client.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Integration, Repository from sentry.shared_integrations.exceptions import ApiError from sentry.testutils import TestCase -from sentry.utils.compat import mock class GitHubAppsClientTest(TestCase): diff --git a/tests/sentry/integrations/github/test_integration.py b/tests/sentry/integrations/github/test_integration.py index 140d1a155464b5..224f4d23f96888 100644 --- a/tests/sentry/integrations/github/test_integration.py +++ b/tests/sentry/integrations/github/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import MagicMock from urllib.parse import urlencode, urlparse import responses @@ -10,7 +11,6 @@ from sentry.plugins.base import plugins from sentry.shared_integrations.exceptions import ApiError from sentry.testutils import IntegrationTestCase -from sentry.utils.compat.mock import MagicMock from tests.sentry.plugins.testutils import register_mock_plugins, unregister_mock_plugins diff --git a/tests/sentry/integrations/github/test_issues.py b/tests/sentry/integrations/github/test_issues.py index 51a9ce0aa2dffc..eba7fc0993536e 100644 --- a/tests/sentry/integrations/github/test_issues.py +++ b/tests/sentry/integrations/github/test_issues.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from django.test import RequestFactory from exam import fixture @@ -7,7 +9,6 @@ from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat.mock import patch class GitHubIssueBasicTest(TestCase): diff --git a/tests/sentry/integrations/github/test_repository.py b/tests/sentry/integrations/github/test_repository.py index 5e5cc4dceb4b94..ebfbd660aba45d 100644 --- a/tests/sentry/integrations/github/test_repository.py +++ b/tests/sentry/integrations/github/test_repository.py @@ -1,4 +1,5 @@ import datetime +from unittest import mock import pytest import responses @@ -10,7 +11,6 @@ from sentry.testutils import PluginTestCase from sentry.testutils.asserts import assert_commit_shape from sentry.utils import json -from sentry.utils.compat import mock from .testutils import COMPARE_COMMITS_EXAMPLE, GET_COMMIT_EXAMPLE, GET_LAST_COMMITS_EXAMPLE diff --git a/tests/sentry/integrations/github/test_webhooks.py b/tests/sentry/integrations/github/test_webhooks.py index 7167dcee43f91f..90918d9cc19a34 100644 --- a/tests/sentry/integrations/github/test_webhooks.py +++ b/tests/sentry/integrations/github/test_webhooks.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from unittest.mock import patch from uuid import uuid4 from django.utils import timezone @@ -6,7 +7,6 @@ from sentry import options from sentry.models import Commit, CommitAuthor, GroupLink, Integration, PullRequest, Repository from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from .testutils import ( PULL_REQUEST_CLOSED_EVENT_EXAMPLE, diff --git a/tests/sentry/integrations/github_enterprise/test_integration.py b/tests/sentry/integrations/github_enterprise/test_integration.py index 1f52cad5d01921..ff5da0149216eb 100644 --- a/tests/sentry/integrations/github_enterprise/test_integration.py +++ b/tests/sentry/integrations/github_enterprise/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import parse_qs, urlencode, urlparse import responses @@ -11,7 +12,6 @@ OrganizationIntegration, ) from sentry.testutils import IntegrationTestCase -from sentry.utils.compat.mock import patch class GitHubEnterpriseIntegrationTest(IntegrationTestCase): diff --git a/tests/sentry/integrations/github_enterprise/test_issues.py b/tests/sentry/integrations/github_enterprise/test_issues.py index 3080b09769fe11..22c2a16a45243d 100644 --- a/tests/sentry/integrations/github_enterprise/test_issues.py +++ b/tests/sentry/integrations/github_enterprise/test_issues.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from django.test import RequestFactory from exam import fixture @@ -6,7 +8,6 @@ from sentry.models import ExternalIssue, Integration from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class GitHubEnterpriseIssueBasicTest(TestCase): diff --git a/tests/sentry/integrations/github_enterprise/test_webhooks.py b/tests/sentry/integrations/github_enterprise/test_webhooks.py index e8f537a3e66367..38ab5b0d87931b 100644 --- a/tests/sentry/integrations/github_enterprise/test_webhooks.py +++ b/tests/sentry/integrations/github_enterprise/test_webhooks.py @@ -1,11 +1,11 @@ from datetime import datetime +from unittest.mock import patch from uuid import uuid4 from django.utils import timezone from sentry.models import Commit, CommitAuthor, Integration, PullRequest, Repository from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from .testutils import ( PULL_REQUEST_CLOSED_EVENT_EXAMPLE, diff --git a/tests/sentry/integrations/gitlab/test_integration.py b/tests/sentry/integrations/gitlab/test_integration.py index 48693e5a944a02..a403ae6a737d1e 100644 --- a/tests/sentry/integrations/gitlab/test_integration.py +++ b/tests/sentry/integrations/gitlab/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import Mock, patch from urllib.parse import parse_qs, urlencode, urlparse import responses @@ -12,7 +13,6 @@ Repository, ) from sentry.testutils import IntegrationTestCase -from sentry.utils.compat.mock import Mock, patch class GitlabIntegrationTest(IntegrationTestCase): diff --git a/tests/sentry/integrations/jira/test_client.py b/tests/sentry/integrations/jira/test_client.py index f673a434da5531..cc9dc20cf06cbc 100644 --- a/tests/sentry/integrations/jira/test_client.py +++ b/tests/sentry/integrations/jira/test_client.py @@ -1,10 +1,11 @@ +from unittest import mock + import responses from sentry.integrations.jira.client import JiraCloud from sentry.models import Integration from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat import mock class StubJiraCloud(JiraCloud): diff --git a/tests/sentry/integrations/jira/test_integration.py b/tests/sentry/integrations/jira/test_integration.py index b18e46392ebdea..0393f34b4aeacf 100644 --- a/tests/sentry/integrations/jira/test_integration.py +++ b/tests/sentry/integrations/jira/test_integration.py @@ -1,4 +1,5 @@ import copy +from unittest import mock import pytest import responses @@ -18,7 +19,6 @@ from sentry.testutils.factories import DEFAULT_EVENT_DATA from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat import mock from sentry.utils.http import absolute_uri from sentry.utils.signing import sign from tests.fixtures.integrations import StubService diff --git a/tests/sentry/integrations/jira/test_issue_hook.py b/tests/sentry/integrations/jira/test_issue_hook.py index 50f630500e772f..cffa71f5b937a9 100644 --- a/tests/sentry/integrations/jira/test_issue_hook.py +++ b/tests/sentry/integrations/jira/test_issue_hook.py @@ -1,4 +1,5 @@ from datetime import datetime +from unittest.mock import patch from django.utils import timezone from jwt import ExpiredSignatureError @@ -6,7 +7,6 @@ from sentry.integrations.atlassian_connect import AtlassianConnectValidationError from sentry.models import ExternalIssue, Group, GroupLink, Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri UNABLE_TO_VERIFY_INSTALLATION = b"Unable to verify installation" diff --git a/tests/sentry/integrations/jira/test_ui_hook.py b/tests/sentry/integrations/jira/test_ui_hook.py index 1b374b62b2e20b..7dde6cbac43ae2 100644 --- a/tests/sentry/integrations/jira/test_ui_hook.py +++ b/tests/sentry/integrations/jira/test_ui_hook.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from jwt import ExpiredSignatureError from sentry.integrations.atlassian_connect import AtlassianConnectValidationError from sentry.models import Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri UNABLE_TO_VERIFY_INSTALLATION = b"Unable to verify installation" diff --git a/tests/sentry/integrations/jira/test_uninstalled.py b/tests/sentry/integrations/jira/test_uninstalled.py index 6d49788d9d1a1e..b6b624d911a8e8 100644 --- a/tests/sentry/integrations/jira/test_uninstalled.py +++ b/tests/sentry/integrations/jira/test_uninstalled.py @@ -1,7 +1,8 @@ +from unittest.mock import patch + from sentry.constants import ObjectStatus from sentry.models import Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch class JiraUninstalledTest(APITestCase): diff --git a/tests/sentry/integrations/jira/test_webhooks.py b/tests/sentry/integrations/jira/test_webhooks.py index 1b7842a656b7fa..7737064eec755b 100644 --- a/tests/sentry/integrations/jira/test_webhooks.py +++ b/tests/sentry/integrations/jira/test_webhooks.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from django.test.utils import override_settings from django.urls import reverse @@ -5,7 +7,6 @@ from sentry.integrations.issues import IssueSyncMixin from sentry.models import Integration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from tests.fixtures.integrations.mock_service import StubService diff --git a/tests/sentry/integrations/jira_server/test_webhooks.py b/tests/sentry/integrations/jira_server/test_webhooks.py index 9f7a70ffc9e3c3..9f3d2d5f3a056f 100644 --- a/tests/sentry/integrations/jira_server/test_webhooks.py +++ b/tests/sentry/integrations/jira_server/test_webhooks.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import jwt import responses from requests.exceptions import ConnectionError @@ -5,7 +7,6 @@ from sentry.integrations.jira_server.integration import JiraServerIntegration from sentry.models import OrganizationIntegration from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from . import EXAMPLE_PAYLOAD, get_integration, link_group diff --git a/tests/sentry/integrations/msteams/test_action_state_change.py b/tests/sentry/integrations/msteams/test_action_state_change.py index adb9042f80154a..fc30c5ea681405 100644 --- a/tests/sentry/integrations/msteams/test_action_state_change.py +++ b/tests/sentry/integrations/msteams/test_action_state_change.py @@ -1,4 +1,5 @@ import time +from unittest.mock import patch import responses from django.http import HttpResponse @@ -21,7 +22,6 @@ from sentry.testutils import APITestCase from sentry.testutils.asserts import assert_mock_called_once_with_partial from sentry.utils import json -from sentry.utils.compat.mock import patch class BaseEventTest(APITestCase): diff --git a/tests/sentry/integrations/msteams/test_client.py b/tests/sentry/integrations/msteams/test_client.py index 8a9b7c7693a78d..65348e8f0e3543 100644 --- a/tests/sentry/integrations/msteams/test_client.py +++ b/tests/sentry/integrations/msteams/test_client.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import urlencode import responses @@ -5,7 +6,6 @@ from sentry.integrations.msteams.client import MsTeamsClient from sentry.models import Integration from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class MsTeamsClientTest(TestCase): diff --git a/tests/sentry/integrations/msteams/test_integration.py b/tests/sentry/integrations/msteams/test_integration.py index 6987f84476f3d6..7c972c83acd9a0 100644 --- a/tests/sentry/integrations/msteams/test_integration.py +++ b/tests/sentry/integrations/msteams/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import urlencode import responses @@ -5,7 +6,6 @@ from sentry.integrations.msteams import MsTeamsIntegrationProvider from sentry.models import Integration, OrganizationIntegration from sentry.testutils import IntegrationTestCase -from sentry.utils.compat.mock import patch from sentry.utils.signing import sign team_id = "19:8d46058cda57449380517cc374727f2a@thread.tacv2" diff --git a/tests/sentry/integrations/msteams/test_link_identity.py b/tests/sentry/integrations/msteams/test_link_identity.py index 2c5dd48adbfcf0..abd0c593918d7d 100644 --- a/tests/sentry/integrations/msteams/test_link_identity.py +++ b/tests/sentry/integrations/msteams/test_link_identity.py @@ -1,4 +1,5 @@ import time +from unittest.mock import patch import responses @@ -12,7 +13,6 @@ ) from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class MsTeamsIntegrationLinkIdentityTest(TestCase): diff --git a/tests/sentry/integrations/msteams/test_webhook.py b/tests/sentry/integrations/msteams/test_webhook.py index 2615dba93ea1ee..011f6daa7e23d0 100644 --- a/tests/sentry/integrations/msteams/test_webhook.py +++ b/tests/sentry/integrations/msteams/test_webhook.py @@ -1,4 +1,5 @@ from copy import deepcopy +from unittest import mock from urllib.parse import urlencode import responses @@ -6,7 +7,6 @@ from sentry.models import Identity, IdentityProvider, Integration from sentry.testutils import APITestCase from sentry.utils import jwt -from sentry.utils.compat import mock from .test_helpers import ( DECODED_TOKEN, diff --git a/tests/sentry/integrations/pagerduty/test_client.py b/tests/sentry/integrations/pagerduty/test_client.py index 838230ff2263a8..3c328fa2d2a0b6 100644 --- a/tests/sentry/integrations/pagerduty/test_client.py +++ b/tests/sentry/integrations/pagerduty/test_client.py @@ -1,11 +1,11 @@ import copy +from unittest.mock import patch from sentry.api.serializers import ExternalEventSerializer, serialize from sentry.models import Integration, PagerDutyService from sentry.testutils import APITestCase from sentry.testutils.factories import DEFAULT_EVENT_DATA from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch # external_id is the account name in pagerduty EXTERNAL_ID = "example-pagerduty" diff --git a/tests/sentry/integrations/slack/endpoints/test_action.py b/tests/sentry/integrations/slack/endpoints/test_action.py index e02571d860ef42..a236b76d7683ed 100644 --- a/tests/sentry/integrations/slack/endpoints/test_action.py +++ b/tests/sentry/integrations/slack/endpoints/test_action.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import parse_qs import responses @@ -24,7 +25,6 @@ ) from sentry.testutils import APITestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from tests.sentry.integrations.slack import add_identity, install_slack diff --git a/tests/sentry/integrations/slack/endpoints/test_event.py b/tests/sentry/integrations/slack/endpoints/test_event.py index c91d757311234f..593be0c3948cf0 100644 --- a/tests/sentry/integrations/slack/endpoints/test_event.py +++ b/tests/sentry/integrations/slack/endpoints/test_event.py @@ -1,4 +1,5 @@ import re +from unittest.mock import Mock, patch from urllib.parse import parse_qsl import responses @@ -7,7 +8,6 @@ from sentry.models import Identity, IdentityProvider, IdentityStatus from sentry.testutils import APITestCase from sentry.utils import json -from sentry.utils.compat.mock import Mock, patch from tests.sentry.integrations.slack import get_response_text, install_slack UNSET = object() diff --git a/tests/sentry/integrations/slack/notifications/test_assigned.py b/tests/sentry/integrations/slack/notifications/test_assigned.py index 65de85bdf13287..7e61e1f54d7147 100644 --- a/tests/sentry/integrations/slack/notifications/test_assigned.py +++ b/tests/sentry/integrations/slack/notifications/test_assigned.py @@ -1,3 +1,4 @@ +from unittest import mock from urllib.parse import parse_qs import responses @@ -5,7 +6,6 @@ from sentry.models import Activity, Identity, IdentityProvider, IdentityStatus, Integration from sentry.notifications.notifications.activity import AssignedActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_deploy.py b/tests/sentry/integrations/slack/notifications/test_deploy.py index 206095185a43ba..9f948bbb538e5a 100644 --- a/tests/sentry/integrations/slack/notifications/test_deploy.py +++ b/tests/sentry/integrations/slack/notifications/test_deploy.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from django.utils import timezone from sentry.models import Activity, Deploy, Release from sentry.notifications.notifications.activity import ReleaseActivityNotification -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_issue_alert.py b/tests/sentry/integrations/slack/notifications/test_issue_alert.py index 24de8867fcdc19..84c52676c9c679 100644 --- a/tests/sentry/integrations/slack/notifications/test_issue_alert.py +++ b/tests/sentry/integrations/slack/notifications/test_issue_alert.py @@ -1,3 +1,5 @@ +from unittest import mock +from unittest.mock import patch from urllib.parse import parse_qs import responses @@ -27,8 +29,6 @@ from sentry.tasks.digests import deliver_digest from sentry.types.integrations import ExternalProviders from sentry.utils import json -from sentry.utils.compat import mock -from sentry.utils.compat.mock import patch from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_new_processing_issues.py b/tests/sentry/integrations/slack/notifications/test_new_processing_issues.py index 3d73d7d0d771e8..5e9607fb81524a 100644 --- a/tests/sentry/integrations/slack/notifications/test_new_processing_issues.py +++ b/tests/sentry/integrations/slack/notifications/test_new_processing_issues.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import NewProcessingIssuesActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_note.py b/tests/sentry/integrations/slack/notifications/test_note.py index 0685fb73517b66..fdc2bdfaf97691 100644 --- a/tests/sentry/integrations/slack/notifications/test_note.py +++ b/tests/sentry/integrations/slack/notifications/test_note.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import NoteActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_regression.py b/tests/sentry/integrations/slack/notifications/test_regression.py index 2f3be6bed35515..16ad34a24dfad6 100644 --- a/tests/sentry/integrations/slack/notifications/test_regression.py +++ b/tests/sentry/integrations/slack/notifications/test_regression.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import RegressionActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_resolved.py b/tests/sentry/integrations/slack/notifications/test_resolved.py index 211f5a46c09075..49a7bcceb90658 100644 --- a/tests/sentry/integrations/slack/notifications/test_resolved.py +++ b/tests/sentry/integrations/slack/notifications/test_resolved.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import ResolvedActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_resolved_in_release.py b/tests/sentry/integrations/slack/notifications/test_resolved_in_release.py index 07fde3a4f93f6f..ea6adcc2a5ed26 100644 --- a/tests/sentry/integrations/slack/notifications/test_resolved_in_release.py +++ b/tests/sentry/integrations/slack/notifications/test_resolved_in_release.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import ResolvedInReleaseActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/notifications/test_unassigned.py b/tests/sentry/integrations/slack/notifications/test_unassigned.py index be38f71d1c102b..5299d4c7241120 100644 --- a/tests/sentry/integrations/slack/notifications/test_unassigned.py +++ b/tests/sentry/integrations/slack/notifications/test_unassigned.py @@ -1,9 +1,10 @@ +from unittest import mock + import responses from sentry.models import Activity from sentry.notifications.notifications.activity import UnassignedActivityNotification from sentry.types.activity import ActivityType -from sentry.utils.compat import mock from . import SlackActivityNotificationTest, get_attachment, send_notification diff --git a/tests/sentry/integrations/slack/test_requests.py b/tests/sentry/integrations/slack/test_requests.py index d6bf3321c9af93..27b8e791a9c3f1 100644 --- a/tests/sentry/integrations/slack/test_requests.py +++ b/tests/sentry/integrations/slack/test_requests.py @@ -1,3 +1,4 @@ +from unittest import mock from urllib.parse import urlencode from sentry import options @@ -9,7 +10,6 @@ from sentry.testutils.helpers import override_options from sentry.utils import json from sentry.utils.cache import memoize -from sentry.utils.compat import mock class SlackRequestTest(TestCase): diff --git a/tests/sentry/integrations/slack/test_tasks.py b/tests/sentry/integrations/slack/test_tasks.py index 3759fe55c4d91f..ddbd81e9c65106 100644 --- a/tests/sentry/integrations/slack/test_tasks.py +++ b/tests/sentry/integrations/slack/test_tasks.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from uuid import uuid4 import responses @@ -14,7 +15,6 @@ from sentry.receivers.rules import DEFAULT_RULE_LABEL from sentry.testutils.cases import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from tests.sentry.integrations.slack import install_slack diff --git a/tests/sentry/integrations/slack/test_unfurl.py b/tests/sentry/integrations/slack/test_unfurl.py index 4c847871536b06..7f37be5518cf88 100644 --- a/tests/sentry/integrations/slack/test_unfurl.py +++ b/tests/sentry/integrations/slack/test_unfurl.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest from django.http.request import QueryDict from django.test import RequestFactory @@ -11,7 +13,6 @@ from sentry.integrations.slack.unfurl import LinkType, UnfurlableUrl, link_handlers, match_link from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from tests.sentry.integrations.slack import install_slack diff --git a/tests/sentry/integrations/test_client.py b/tests/sentry/integrations/test_client.py index 519a43facb2858..51b572c0b9dfd5 100644 --- a/tests/sentry/integrations/test_client.py +++ b/tests/sentry/integrations/test_client.py @@ -1,4 +1,5 @@ from time import time +from unittest import mock import responses @@ -7,7 +8,6 @@ from sentry.integrations.client import ApiClient, OAuth2RefreshMixin from sentry.models import Identity, IdentityProvider from sentry.testutils import TestCase -from sentry.utils.compat import mock class ApiClientTest(TestCase): diff --git a/tests/sentry/integrations/test_pipeline.py b/tests/sentry/integrations/test_pipeline.py index ebde3b9a36f415..297d9b49fa470c 100644 --- a/tests/sentry/integrations/test_pipeline.py +++ b/tests/sentry/integrations/test_pipeline.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from sentry.integrations.example import AliasedIntegrationProvider, ExampleIntegrationProvider from sentry.integrations.gitlab.integration import GitlabIntegrationProvider from sentry.models import ( @@ -10,7 +12,6 @@ from sentry.plugins.base import plugins from sentry.plugins.bases.issue2 import IssuePlugin2 from sentry.testutils import IntegrationTestCase -from sentry.utils.compat.mock import patch class ExamplePlugin(IssuePlugin2): diff --git a/tests/sentry/integrations/test_ticket_rules.py b/tests/sentry/integrations/test_ticket_rules.py index b54ce929774349..863073c89a39a8 100644 --- a/tests/sentry/integrations/test_ticket_rules.py +++ b/tests/sentry/integrations/test_ticket_rules.py @@ -1,4 +1,5 @@ from collections import namedtuple +from unittest import mock from django.urls import reverse from rest_framework.test import APITestCase as BaseAPITestCase @@ -9,7 +10,6 @@ from sentry.models.integration import Integration from sentry.models.rule import Rule from sentry.testutils import RuleTestCase -from sentry.utils.compat import mock from tests.fixtures.integrations.jira import MockJira RuleFuture = namedtuple("RuleFuture", ["rule", "kwargs"]) diff --git a/tests/sentry/integrations/vsts/test_integration.py b/tests/sentry/integrations/vsts/test_integration.py index b67045bbe3e064..08d232d22ac7da 100644 --- a/tests/sentry/integrations/vsts/test_integration.py +++ b/tests/sentry/integrations/vsts/test_integration.py @@ -1,3 +1,4 @@ +from unittest.mock import Mock, patch from urllib.parse import parse_qs, urlparse import pytest @@ -15,7 +16,6 @@ from sentry.plugins.base import plugins from sentry.shared_integrations.exceptions import IntegrationError, IntegrationProviderError from sentry.testutils.helpers import with_feature -from sentry.utils.compat.mock import Mock, patch from tests.sentry.plugins.testutils import ( VstsPlugin, register_mock_plugins, diff --git a/tests/sentry/integrations/vsts/test_provider.py b/tests/sentry/integrations/vsts/test_provider.py index e06e2e5bea54eb..bfd3a4f7cbbcf1 100644 --- a/tests/sentry/integrations/vsts/test_provider.py +++ b/tests/sentry/integrations/vsts/test_provider.py @@ -1,4 +1,5 @@ from time import time +from unittest.mock import Mock, patch from urllib.parse import parse_qs import responses @@ -8,7 +9,6 @@ from sentry.integrations.vsts.integration import AccountConfigView, AccountForm from sentry.models import Identity, IdentityProvider from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock, patch from sentry.utils.http import absolute_uri diff --git a/tests/sentry/integrations/vsts/test_webhooks.py b/tests/sentry/integrations/vsts/test_webhooks.py index cdf2d346394b12..4a7a10554fe73c 100644 --- a/tests/sentry/integrations/vsts/test_webhooks.py +++ b/tests/sentry/integrations/vsts/test_webhooks.py @@ -1,4 +1,5 @@ from time import time +from unittest.mock import patch import responses @@ -14,7 +15,6 @@ Integration, ) from sentry.testutils import APITestCase -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri from .testutils import ( diff --git a/tests/sentry/integrations/vsts_extension/test_provider.py b/tests/sentry/integrations/vsts_extension/test_provider.py index 77d3b94108a26a..560c8e292f6f78 100644 --- a/tests/sentry/integrations/vsts_extension/test_provider.py +++ b/tests/sentry/integrations/vsts_extension/test_provider.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from urllib.parse import parse_qs, urlparse from django.urls import reverse @@ -8,7 +9,6 @@ VstsExtensionIntegrationProvider, ) from sentry.models import Integration -from sentry.utils.compat.mock import patch from tests.sentry.integrations.vsts.test_integration import FULL_SCOPES from tests.sentry.integrations.vsts.testutils import VstsIntegrationTestCase diff --git a/tests/sentry/lang/javascript/test_processor.py b/tests/sentry/lang/javascript/test_processor.py index ed6dfc88548edb..bdae5a6bc45d5f 100644 --- a/tests/sentry/lang/javascript/test_processor.py +++ b/tests/sentry/lang/javascript/test_processor.py @@ -4,6 +4,7 @@ import zipfile from copy import deepcopy from io import BytesIO +from unittest.mock import ANY, MagicMock, call, patch import pytest import responses @@ -35,7 +36,6 @@ from sentry.testutils import TestCase from sentry.testutils.helpers.options import override_options from sentry.utils import json -from sentry.utils.compat.mock import ANY, MagicMock, call, patch from sentry.utils.strings import truncatechars base64_sourcemap = "data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvdGVzdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zb2xlLmxvZyhcImhlbGxvLCBXb3JsZCFcIikiXX0=" diff --git a/tests/sentry/loader/test_browsersdkversion.py b/tests/sentry/loader/test_browsersdkversion.py index be6c47154b5c6e..136137559d2bc6 100644 --- a/tests/sentry/loader/test_browsersdkversion.py +++ b/tests/sentry/loader/test_browsersdkversion.py @@ -1,3 +1,5 @@ +from unittest import mock + from django.conf import settings from sentry.loader.browsersdkversion import ( @@ -6,7 +8,6 @@ get_highest_selected_browser_sdk_version, ) from sentry.testutils import TestCase -from sentry.utils.compat import mock MOCK_VERSIONS = [ "4.0.0-rc.1", diff --git a/tests/sentry/logging/test_handler.py b/tests/sentry/logging/test_handler.py index 9df9f36a0dbfa1..e6aba487219916 100644 --- a/tests/sentry/logging/test_handler.py +++ b/tests/sentry/logging/test_handler.py @@ -1,9 +1,9 @@ import logging +from unittest import mock import pytest from sentry.logging.handlers import StructLogHandler -from sentry.utils.compat import mock @pytest.fixture diff --git a/tests/sentry/mail/test_adapter.py b/tests/sentry/mail/test_adapter.py index 7af0b8054e4100..d7c6e600f86159 100644 --- a/tests/sentry/mail/test_adapter.py +++ b/tests/sentry/mail/test_adapter.py @@ -1,5 +1,6 @@ from collections import Counter from datetime import datetime +from unittest import mock import pytz from django.contrib.auth.models import AnonymousUser @@ -44,7 +45,6 @@ from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.types.integrations import ExternalProviders -from sentry.utils.compat import mock from sentry.utils.email import MessageBuilder, get_email_addresses from sentry_plugins.opsgenie.plugin import OpsGeniePlugin from tests.sentry.mail import make_event_data, send_notification diff --git a/tests/sentry/mediators/sentry_app_components/test_preparer.py b/tests/sentry/mediators/sentry_app_components/test_preparer.py index e52f93f45c1c9e..518c2269fdcbd2 100644 --- a/tests/sentry/mediators/sentry_app_components/test_preparer.py +++ b/tests/sentry/mediators/sentry_app_components/test_preparer.py @@ -1,6 +1,7 @@ +from unittest.mock import call, patch + from sentry.mediators.sentry_app_components import Preparer from sentry.testutils import TestCase -from sentry.utils.compat.mock import call, patch class TestPreparerIssueLink(TestCase): diff --git a/tests/sentry/mediators/sentry_app_installation_tokens/test_creator.py b/tests/sentry/mediators/sentry_app_installation_tokens/test_creator.py index 4bcb55892eb8a4..6aa05cdbc6d025 100644 --- a/tests/sentry/mediators/sentry_app_installation_tokens/test_creator.py +++ b/tests/sentry/mediators/sentry_app_installation_tokens/test_creator.py @@ -1,10 +1,10 @@ from datetime import date +from unittest.mock import patch from sentry.mediators.sentry_app_installation_tokens import Creator from sentry.mediators.sentry_app_installations import Creator as SentryAppInstallationCreator from sentry.models import AuditLogEntry, SentryAppInstallation, SentryAppInstallationToken from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestCreatorBase(TestCase): diff --git a/tests/sentry/mediators/sentry_app_installation_tokens/test_destroyer.py b/tests/sentry/mediators/sentry_app_installation_tokens/test_destroyer.py index c22a0f9fd4a9f7..93bf00c09d3a8d 100644 --- a/tests/sentry/mediators/sentry_app_installation_tokens/test_destroyer.py +++ b/tests/sentry/mediators/sentry_app_installation_tokens/test_destroyer.py @@ -1,7 +1,8 @@ +from unittest.mock import patch + from sentry.mediators.sentry_app_installation_tokens import Destroyer from sentry.models import ApiToken, AuditLogEntry, SentryAppInstallation, SentryAppInstallationToken from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestDestroyer(TestCase): diff --git a/tests/sentry/mediators/sentry_app_installations/test_creator.py b/tests/sentry/mediators/sentry_app_installations/test_creator.py index 830f53cf0323dc..7398d98447554d 100644 --- a/tests/sentry/mediators/sentry_app_installations/test_creator.py +++ b/tests/sentry/mediators/sentry_app_installations/test_creator.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from sentry.constants import SentryAppInstallationStatus @@ -10,7 +12,6 @@ ServiceHookProject, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestCreator(TestCase): diff --git a/tests/sentry/mediators/sentry_app_installations/test_destroyer.py b/tests/sentry/mediators/sentry_app_installations/test_destroyer.py index 7422afb86a969f..c2926873cba739 100644 --- a/tests/sentry/mediators/sentry_app_installations/test_destroyer.py +++ b/tests/sentry/mediators/sentry_app_installations/test_destroyer.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from django.db import connection from requests.exceptions import RequestException @@ -13,7 +15,6 @@ ServiceHook, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestDestroyer(TestCase): diff --git a/tests/sentry/mediators/sentry_app_installations/test_installation_notifier.py b/tests/sentry/mediators/sentry_app_installations/test_installation_notifier.py index f07384f1f1c690..2f294459b79728 100644 --- a/tests/sentry/mediators/sentry_app_installations/test_installation_notifier.py +++ b/tests/sentry/mediators/sentry_app_installations/test_installation_notifier.py @@ -1,11 +1,11 @@ from collections import namedtuple +from unittest.mock import patch from sentry.coreapi import APIUnauthorized from sentry.mediators.sentry_app_installations import InstallationNotifier from sentry.testutils import TestCase from sentry.testutils.helpers.faux import faux from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry.utils.sentryappwebhookrequests import SentryAppWebhookRequestsBuffer diff --git a/tests/sentry/mediators/sentry_apps/test_creator.py b/tests/sentry/mediators/sentry_apps/test_creator.py index c731214b74acb4..5a37709224abf5 100644 --- a/tests/sentry/mediators/sentry_apps/test_creator.py +++ b/tests/sentry/mediators/sentry_apps/test_creator.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.db import IntegrityError from sentry.mediators.sentry_apps import Creator @@ -11,7 +13,6 @@ User, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestCreator(TestCase): diff --git a/tests/sentry/mediators/sentry_apps/test_destroyer.py b/tests/sentry/mediators/sentry_apps/test_destroyer.py index 614480d807d40d..35b03e597d3818 100644 --- a/tests/sentry/mediators/sentry_apps/test_destroyer.py +++ b/tests/sentry/mediators/sentry_apps/test_destroyer.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from django.db import connection @@ -11,7 +13,6 @@ User, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestDestroyer(TestCase): diff --git a/tests/sentry/mediators/sentry_apps/test_internal_creator.py b/tests/sentry/mediators/sentry_apps/test_internal_creator.py index 6703f92d313897..1727cf28eb024a 100644 --- a/tests/sentry/mediators/sentry_apps/test_internal_creator.py +++ b/tests/sentry/mediators/sentry_apps/test_internal_creator.py @@ -1,8 +1,9 @@ +from unittest.mock import MagicMock, patch + from sentry.mediators.sentry_apps import InternalCreator from sentry.models import AuditLogEntryEvent, SentryApp, SentryAppInstallation from sentry.testutils import TestCase from sentry.testutils.helpers.faux import faux -from sentry.utils.compat.mock import MagicMock, patch class TestInternalCreator(TestCase): diff --git a/tests/sentry/mediators/test_mediator.py b/tests/sentry/mediators/test_mediator.py index 5a080fc22df467..e90ede8c95c0b0 100644 --- a/tests/sentry/mediators/test_mediator.py +++ b/tests/sentry/mediators/test_mediator.py @@ -1,11 +1,11 @@ import logging import types +from unittest.mock import PropertyMock, patch from sentry.mediators import Mediator, Param from sentry.models import User from sentry.testutils import TestCase from sentry.testutils.helpers.faux import faux -from sentry.utils.compat.mock import PropertyMock, patch class Double: diff --git a/tests/sentry/mediators/token_exchange/test_grant_exchanger.py b/tests/sentry/mediators/token_exchange/test_grant_exchanger.py index a33213a2701219..da86133e33f674 100644 --- a/tests/sentry/mediators/token_exchange/test_grant_exchanger.py +++ b/tests/sentry/mediators/token_exchange/test_grant_exchanger.py @@ -1,10 +1,10 @@ from datetime import datetime, timedelta +from unittest.mock import patch from sentry.coreapi import APIUnauthorized from sentry.mediators.token_exchange import GrantExchanger from sentry.models import ApiApplication, ApiGrant, SentryApp, SentryAppInstallation from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestGrantExchanger(TestCase): diff --git a/tests/sentry/mediators/token_exchange/test_refresher.py b/tests/sentry/mediators/token_exchange/test_refresher.py index 87ffd10656cc3f..923ea3d90bc7bc 100644 --- a/tests/sentry/mediators/token_exchange/test_refresher.py +++ b/tests/sentry/mediators/token_exchange/test_refresher.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from sentry.coreapi import APIUnauthorized from sentry.mediators.token_exchange import GrantExchanger, Refresher from sentry.models import ApiApplication, ApiToken, SentryApp, SentryAppInstallation from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestRefresher(TestCase): diff --git a/tests/sentry/mediators/token_exchange/test_validator.py b/tests/sentry/mediators/token_exchange/test_validator.py index b6d7f1eac8ce3b..bdaca16aa53e91 100644 --- a/tests/sentry/mediators/token_exchange/test_validator.py +++ b/tests/sentry/mediators/token_exchange/test_validator.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from sentry.coreapi import APIUnauthorized from sentry.mediators.token_exchange import Validator from sentry.models import SentryApp from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class TestValidator(TestCase): diff --git a/tests/sentry/metrics/test_datadog.py b/tests/sentry/metrics/test_datadog.py index be5682e689d3cd..3b9f6fc19d3a3f 100644 --- a/tests/sentry/metrics/test_datadog.py +++ b/tests/sentry/metrics/test_datadog.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from datadog.util.hostname import get_hostname from sentry.metrics.datadog import DatadogMetricsBackend from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class DatadogMetricsBackendTest(TestCase): diff --git a/tests/sentry/metrics/test_statsd.py b/tests/sentry/metrics/test_statsd.py index 3b7b3a2d929e63..5ea798a64c7412 100644 --- a/tests/sentry/metrics/test_statsd.py +++ b/tests/sentry/metrics/test_statsd.py @@ -1,6 +1,7 @@ +from unittest.mock import patch + from sentry.metrics.statsd import StatsdMetricsBackend from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class StatsdMetricsBackendTest(TestCase): diff --git a/tests/sentry/middleware/test_health.py b/tests/sentry/middleware/test_health.py index feb32456e00f93..7bcf389ec6634d 100644 --- a/tests/sentry/middleware/test_health.py +++ b/tests/sentry/middleware/test_health.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.test import RequestFactory from exam import fixture @@ -5,7 +7,6 @@ from sentry.status_checks import Problem from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class HealthCheckTest(TestCase): diff --git a/tests/sentry/middleware/test_stats.py b/tests/sentry/middleware/test_stats.py index 2fd3b7e509e53e..0afe146280f792 100644 --- a/tests/sentry/middleware/test_stats.py +++ b/tests/sentry/middleware/test_stats.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + from django.test import RequestFactory from exam import fixture from sentry.middleware.stats import RequestTimingMiddleware, add_request_metric_tags from sentry.testutils import TestCase from sentry.testutils.helpers.faux import Mock -from sentry.utils.compat.mock import patch class RequestTimingMiddlewareTest(TestCase): diff --git a/tests/sentry/models/test_groupassignee.py b/tests/sentry/models/test_groupassignee.py index 814df4af62ef4c..29c236103c9e6a 100644 --- a/tests/sentry/models/test_groupassignee.py +++ b/tests/sentry/models/test_groupassignee.py @@ -1,3 +1,5 @@ +from unittest import mock + import pytest from sentry.integrations.example.integration import ExampleIntegration @@ -11,7 +13,6 @@ OrganizationIntegration, ) from sentry.testutils import TestCase -from sentry.utils.compat import mock class GroupAssigneeTestCase(TestCase): diff --git a/tests/sentry/models/test_groupinbox.py b/tests/sentry/models/test_groupinbox.py index 31542998a0967f..f7e93078129c45 100644 --- a/tests/sentry/models/test_groupinbox.py +++ b/tests/sentry/models/test_groupinbox.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from sentry.models import ( Activity, GroupInbox, @@ -7,7 +9,6 @@ remove_group_from_inbox, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class GroupInboxTestCase(TestCase): diff --git a/tests/sentry/models/test_groupsnooze.py b/tests/sentry/models/test_groupsnooze.py index c8aad2f76b468d..bbe0cdc33a119e 100644 --- a/tests/sentry/models/test_groupsnooze.py +++ b/tests/sentry/models/test_groupsnooze.py @@ -1,5 +1,6 @@ import itertools from datetime import datetime, timedelta +from unittest import mock import pytest from django.utils import timezone @@ -8,7 +9,6 @@ from sentry.models import Group, GroupSnooze from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class GroupSnoozeTest(TestCase, SnubaTestCase): diff --git a/tests/sentry/models/test_monitor.py b/tests/sentry/models/test_monitor.py index 22c644cf34bec5..693872ba309dc9 100644 --- a/tests/sentry/models/test_monitor.py +++ b/tests/sentry/models/test_monitor.py @@ -1,10 +1,10 @@ from datetime import datetime +from unittest.mock import patch from django.utils import timezone from sentry.models import Monitor, MonitorFailure, MonitorType, ScheduleType from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class MonitorTestCase(TestCase): diff --git a/tests/sentry/models/test_organization.py b/tests/sentry/models/test_organization.py index 784827118269c8..1558f3b357dd4b 100644 --- a/tests/sentry/models/test_organization.py +++ b/tests/sentry/models/test_organization.py @@ -1,4 +1,5 @@ import copy +from unittest import mock from uuid import uuid4 from django.core import mail @@ -33,7 +34,6 @@ User, ) from sentry.testutils import TestCase -from sentry.utils.compat import mock class OrganizationTest(TestCase): diff --git a/tests/sentry/models/test_organizationmember.py b/tests/sentry/models/test_organizationmember.py index 260b7a15ccff1a..b4355daf426bff 100644 --- a/tests/sentry/models/test_organizationmember.py +++ b/tests/sentry/models/test_organizationmember.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import patch from django.core import mail from django.utils import timezone @@ -6,7 +7,6 @@ from sentry.auth import manager from sentry.models import INVITE_DAYS_VALID, InviteStatus, OrganizationMember from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class OrganizationMemberTest(TestCase): diff --git a/tests/sentry/models/test_recentsearch.py b/tests/sentry/models/test_recentsearch.py index def424d583a0d9..d6d434d3002576 100644 --- a/tests/sentry/models/test_recentsearch.py +++ b/tests/sentry/models/test_recentsearch.py @@ -1,10 +1,10 @@ from datetime import timedelta +from unittest.mock import patch from django.utils import timezone from sentry.models.recentsearch import RecentSearch, remove_excess_recent_searches from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.hashlib import md5_text diff --git a/tests/sentry/models/test_release.py b/tests/sentry/models/test_release.py index bf30a3afe314f1..9b3b57362dd49d 100644 --- a/tests/sentry/models/test_release.py +++ b/tests/sentry/models/test_release.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest from django.utils import timezone from freezegun import freeze_time @@ -32,7 +34,6 @@ ) from sentry.search.events.filter import parse_semver from sentry.testutils import SetRefsTestCase, TestCase -from sentry.utils.compat.mock import patch from sentry.utils.strings import truncatechars diff --git a/tests/sentry/net/test_socket.py b/tests/sentry/net/test_socket.py index b01544efb3cd7a..4785d1e9f49cfd 100644 --- a/tests/sentry/net/test_socket.py +++ b/tests/sentry/net/test_socket.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest from django.core.exceptions import SuspiciousOperation from django.test import override_settings @@ -10,7 +12,6 @@ ) from sentry.testutils import TestCase from sentry.testutils.helpers import override_blacklist -from sentry.utils.compat.mock import patch class SocketTest(TestCase): diff --git a/tests/sentry/nodestore/bigtable/backend/tests.py b/tests/sentry/nodestore/bigtable/backend/tests.py index 370ea119eaa116..58cd82e6fa61df 100644 --- a/tests/sentry/nodestore/bigtable/backend/tests.py +++ b/tests/sentry/nodestore/bigtable/backend/tests.py @@ -1,12 +1,12 @@ import os from contextlib import contextmanager +from unittest import mock import pytest from google.oauth2.credentials import Credentials from google.rpc.status_pb2 import Status from sentry.nodestore.bigtable.backend import BigtableKVStorage, BigtableNodeStorage -from sentry.utils.compat import mock class MockedBigtableKVStorage(BigtableKVStorage): diff --git a/tests/sentry/nodestore/django/backend/tests.py b/tests/sentry/nodestore/django/backend/tests.py index 6014214a195f1d..683835250c7eb3 100644 --- a/tests/sentry/nodestore/django/backend/tests.py +++ b/tests/sentry/nodestore/django/backend/tests.py @@ -1,5 +1,6 @@ import pickle from datetime import timedelta +from unittest import mock import pytest from django.utils import timezone @@ -7,7 +8,6 @@ from sentry.nodestore.base import json_dumps from sentry.nodestore.django.backend import DjangoNodeStorage from sentry.nodestore.django.models import Node -from sentry.utils.compat import mock from sentry.utils.strings import compress diff --git a/tests/sentry/notifications/test_digests.py b/tests/sentry/notifications/test_digests.py index eef85eb29311fe..5c03bdf7623562 100644 --- a/tests/sentry/notifications/test_digests.py +++ b/tests/sentry/notifications/test_digests.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail import sentry @@ -8,7 +10,6 @@ from sentry.tasks.digests import deliver_digest from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch USER_COUNT = 2 diff --git a/tests/sentry/options/test_manager.py b/tests/sentry/options/test_manager.py index f86ffd7c775fea..817cf7ce2d00b0 100644 --- a/tests/sentry/options/test_manager.py +++ b/tests/sentry/options/test_manager.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.conf import settings from django.core.cache.backends.locmem import LocMemCache from exam import around, fixture @@ -15,7 +17,6 @@ ) from sentry.options.store import OptionsStore from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.types import Int, String diff --git a/tests/sentry/options/test_store.py b/tests/sentry/options/test_store.py index a3a315233a9454..66e3beb1482370 100644 --- a/tests/sentry/options/test_store.py +++ b/tests/sentry/options/test_store.py @@ -1,3 +1,4 @@ +from unittest.mock import patch from uuid import uuid1 import pytest @@ -8,7 +9,6 @@ from sentry.models import Option from sentry.options.store import OptionsStore from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class OptionsStoreTest(TestCase): diff --git a/tests/sentry/plugins/bases/issue/tests.py b/tests/sentry/plugins/bases/issue/tests.py index 48cbfcec1965bd..b5918bd7fa664e 100644 --- a/tests/sentry/plugins/bases/issue/tests.py +++ b/tests/sentry/plugins/bases/issue/tests.py @@ -1,7 +1,8 @@ +from unittest import mock + from sentry.models import User from sentry.plugins.bases import IssueTrackingPlugin from sentry.testutils import TestCase -from sentry.utils.compat import mock from social_auth.models import UserSocialAuth diff --git a/tests/sentry/plugins/bases/test_issue2.py b/tests/sentry/plugins/bases/test_issue2.py index dac6f128a8ad29..fdb90f3643f556 100644 --- a/tests/sentry/plugins/bases/test_issue2.py +++ b/tests/sentry/plugins/bases/test_issue2.py @@ -1,10 +1,11 @@ +from unittest import mock + from sentry.models import GroupMeta, User from sentry.plugins.base import plugins from sentry.plugins.bases import IssueTrackingPlugin2 from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat import mock from social_auth.models import UserSocialAuth diff --git a/tests/sentry/plugins/helpers/tests.py b/tests/sentry/plugins/helpers/tests.py index 76263613ad90f1..439d63d858d0f8 100644 --- a/tests/sentry/plugins/helpers/tests.py +++ b/tests/sentry/plugins/helpers/tests.py @@ -1,6 +1,7 @@ +from unittest import mock + from sentry.plugins.helpers import get_option, set_option, unset_option from sentry.testutils import TestCase -from sentry.utils.compat import mock class SentryPluginTest(TestCase): diff --git a/tests/sentry/quotas/redis/tests.py b/tests/sentry/quotas/redis/tests.py index 219f8fd2c6abdc..b13fe88f4402eb 100644 --- a/tests/sentry/quotas/redis/tests.py +++ b/tests/sentry/quotas/redis/tests.py @@ -1,4 +1,5 @@ import time +from unittest import mock from exam import fixture, patcher @@ -6,7 +7,7 @@ from sentry.quotas.base import QuotaConfig, QuotaScope from sentry.quotas.redis import RedisQuota, is_rate_limited from sentry.testutils import TestCase -from sentry.utils.compat import map, mock +from sentry.utils.compat import map from sentry.utils.redis import clusters diff --git a/tests/sentry/receivers/test_releases.py b/tests/sentry/receivers/test_releases.py index 060c521733af6a..4bbbef2ebcd371 100644 --- a/tests/sentry/receivers/test_releases.py +++ b/tests/sentry/receivers/test_releases.py @@ -1,4 +1,5 @@ from hashlib import sha1 +from unittest.mock import patch from uuid import uuid4 from sentry.models import ( @@ -22,7 +23,6 @@ add_group_to_inbox, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class ResolveGroupResolutionsTest(TestCase): diff --git a/tests/sentry/receivers/test_sentry_apps.py b/tests/sentry/receivers/test_sentry_apps.py index eea60abc5a811f..eb922828a6692b 100644 --- a/tests/sentry/receivers/test_sentry_apps.py +++ b/tests/sentry/receivers/test_sentry_apps.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from sentry.constants import SentryAppInstallationStatus from sentry.models import Commit, GroupAssignee, GroupLink, Release, Repository from sentry.testutils import APITestCase from sentry.testutils.helpers.faux import faux -from sentry.utils.compat.mock import patch # This testcase needs to be an APITestCase because all of the logic to resolve diff --git a/tests/sentry/receivers/test_signals.py b/tests/sentry/receivers/test_signals.py index 73fe62136e5745..0ed6f1a023abbf 100644 --- a/tests/sentry/receivers/test_signals.py +++ b/tests/sentry/receivers/test_signals.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from django.utils import timezone from sentry.models.groupinbox import GroupInboxReason, add_group_to_inbox from sentry.signals import inbox_in, inbox_out, issue_mark_reviewed, issue_unignored from sentry.testutils import SnubaTestCase, TestCase -from sentry.utils.compat.mock import patch class SignalsTest(TestCase, SnubaTestCase): diff --git a/tests/sentry/receivers/test_transactions.py b/tests/sentry/receivers/test_transactions.py index 4bfeb05a4dbb69..985724f947f1f1 100644 --- a/tests/sentry/receivers/test_transactions.py +++ b/tests/sentry/receivers/test_transactions.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + from exam import fixture from sentry.models import OrganizationMember, Project from sentry.signals import event_processed, transaction_processed from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch class RecordFirstTransactionTest(TestCase): diff --git a/tests/sentry/rules/actions/test_notify_event.py b/tests/sentry/rules/actions/test_notify_event.py index 9ae2620b9dbccf..30e4762a5c2329 100644 --- a/tests/sentry/rules/actions/test_notify_event.py +++ b/tests/sentry/rules/actions/test_notify_event.py @@ -1,7 +1,8 @@ +from unittest.mock import MagicMock + from sentry.rules.actions.notify_event import NotifyEventAction from sentry.rules.actions.services import LegacyPluginService from sentry.testutils.cases import RuleTestCase -from sentry.utils.compat.mock import MagicMock class NotifyEventActionTest(RuleTestCase): diff --git a/tests/sentry/rules/actions/test_notify_event_service.py b/tests/sentry/rules/actions/test_notify_event_service.py index 09eb94788e6a1d..e085dda7d28865 100644 --- a/tests/sentry/rules/actions/test_notify_event_service.py +++ b/tests/sentry/rules/actions/test_notify_event_service.py @@ -1,9 +1,10 @@ +from unittest.mock import MagicMock, patch + from django.utils import timezone from sentry.rules.actions.notify_event_service import NotifyEventServiceAction from sentry.tasks.sentry_apps import notify_sentry_app from sentry.testutils.cases import RuleTestCase -from sentry.utils.compat.mock import MagicMock, patch class NotifyEventServiceActionTest(RuleTestCase): diff --git a/tests/sentry/rules/filters/test_age_comparison.py b/tests/sentry/rules/filters/test_age_comparison.py index 893172e59991c4..4984e4bda34e68 100644 --- a/tests/sentry/rules/filters/test_age_comparison.py +++ b/tests/sentry/rules/filters/test_age_comparison.py @@ -1,11 +1,11 @@ from datetime import datetime, timedelta +from unittest import mock import pytz from django.utils import timezone from sentry.rules.filters.age_comparison import AgeComparisonFilter from sentry.testutils.cases import RuleTestCase -from sentry.utils.compat import mock class AgeComparisonFilterTest(RuleTestCase): diff --git a/tests/sentry/rules/test_processor.py b/tests/sentry/rules/test_processor.py index 1675c12ba389c1..8cab25c64a44d3 100644 --- a/tests/sentry/rules/test_processor.py +++ b/tests/sentry/rules/test_processor.py @@ -1,5 +1,6 @@ from datetime import timedelta from unittest import mock +from unittest.mock import patch from django.core.cache import cache from django.db import DEFAULT_DB_ALIAS, connections @@ -12,7 +13,6 @@ from sentry.rules.filters.base import EventFilter from sentry.rules.processor import RuleProcessor from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch EMAIL_ACTION_DATA = { "id": "sentry.mail.actions.NotifyEmailAction", diff --git a/tests/sentry/runner/commands/test_killswitches.py b/tests/sentry/runner/commands/test_killswitches.py index f0fc20fd809b67..74c8ba5d44eeb5 100644 --- a/tests/sentry/runner/commands/test_killswitches.py +++ b/tests/sentry/runner/commands/test_killswitches.py @@ -1,7 +1,8 @@ +from unittest import mock + from sentry.killswitches import KillswitchInfo from sentry.runner.commands.killswitches import killswitches from sentry.testutils import CliTestCase -from sentry.utils.compat import mock OPTION = "store.load-shed-group-creation-projects" diff --git a/tests/sentry/search/test_utils.py b/tests/sentry/search/test_utils.py index ec739e52c3f1cb..47b3e4fe5f9787 100644 --- a/tests/sentry/search/test_utils.py +++ b/tests/sentry/search/test_utils.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from unittest import mock import pytest from django.utils import timezone @@ -23,7 +24,6 @@ tokenize_query, ) from sentry.testutils import TestCase -from sentry.utils.compat import mock def test_get_numeric_field_value(): diff --git a/tests/sentry/snuba/test_discover.py b/tests/sentry/snuba/test_discover.py index 0a37aa0ac21660..cabace7e9a71b9 100644 --- a/tests/sentry/snuba/test_discover.py +++ b/tests/sentry/snuba/test_discover.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from unittest.mock import patch import pytest from django.utils import timezone @@ -27,7 +28,6 @@ from sentry.snuba import discover from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from sentry.utils.samples import load_data from sentry.utils.snuba import Dataset, get_array_column_alias diff --git a/tests/sentry/snuba/test_query_subscription_consumer.py b/tests/sentry/snuba/test_query_subscription_consumer.py index 62ae2edddef19e..32cf64db9170a1 100644 --- a/tests/sentry/snuba/test_query_subscription_consumer.py +++ b/tests/sentry/snuba/test_query_subscription_consumer.py @@ -1,6 +1,7 @@ import unittest from copy import deepcopy from datetime import timedelta +from unittest import mock import pytz from dateutil.parser import parse as parse_date @@ -18,7 +19,6 @@ from sentry.snuba.subscriptions import create_snuba_query, create_snuba_subscription from sentry.testutils.cases import TestCase from sentry.utils import json -from sentry.utils.compat import mock class BaseQuerySubscriptionTest: diff --git a/tests/sentry/snuba/test_tasks.py b/tests/sentry/snuba/test_tasks.py index 80b3a3c275d25e..426309e6728d9f 100644 --- a/tests/sentry/snuba/test_tasks.py +++ b/tests/sentry/snuba/test_tasks.py @@ -1,4 +1,5 @@ import abc +from unittest.mock import Mock, patch from uuid import uuid4 import pytest @@ -18,7 +19,6 @@ ) from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import Mock, patch from sentry.utils.snuba import _snuba_pool diff --git a/tests/sentry/tasks/post_process/tests.py b/tests/sentry/tasks/post_process/tests.py index 5c3d4160524109..e34a3b45613563 100644 --- a/tests/sentry/tasks/post_process/tests.py +++ b/tests/sentry/tasks/post_process/tests.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import ANY, Mock, patch from django.utils import timezone @@ -23,7 +24,6 @@ from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.testutils.helpers.eventprocessing import write_event_to_cache from sentry.utils.cache import cache -from sentry.utils.compat.mock import ANY, Mock, patch class EventMatcher: diff --git a/tests/sentry/tasks/process_buffer/tests.py b/tests/sentry/tasks/process_buffer/tests.py index 7b7a3b284e95f8..92386ba167b7eb 100644 --- a/tests/sentry/tasks/process_buffer/tests.py +++ b/tests/sentry/tasks/process_buffer/tests.py @@ -1,6 +1,7 @@ +from unittest import mock + from sentry.tasks.process_buffer import process_incr, process_pending from sentry.testutils import TestCase -from sentry.utils.compat import mock class ProcessIncrTest(TestCase): diff --git a/tests/sentry/tasks/test_activity.py b/tests/sentry/tasks/test_activity.py index d7a010c2bb08ee..97b1572809024b 100644 --- a/tests/sentry/tasks/test_activity.py +++ b/tests/sentry/tasks/test_activity.py @@ -1,8 +1,9 @@ +from unittest import mock + from sentry.models import Activity from sentry.plugins.bases.notify import NotificationPlugin from sentry.testutils import PluginTestCase from sentry.types.activity import ActivityType -from sentry.utils.compat import mock class BasicPreprocessorPlugin(NotificationPlugin): diff --git a/tests/sentry/tasks/test_assemble.py b/tests/sentry/tasks/test_assemble.py index bc7f69f4731bcd..76b084d2205080 100644 --- a/tests/sentry/tasks/test_assemble.py +++ b/tests/sentry/tasks/test_assemble.py @@ -1,6 +1,7 @@ import io import os from hashlib import sha1 +from unittest.mock import patch from django.core.files.base import ContentFile @@ -16,7 +17,6 @@ get_assemble_status, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class BaseAssembleTest(TestCase): diff --git a/tests/sentry/tasks/test_auto_resolve_issues.py b/tests/sentry/tasks/test_auto_resolve_issues.py index fe67693b5cc757..7d265f1bc8974f 100644 --- a/tests/sentry/tasks/test_auto_resolve_issues.py +++ b/tests/sentry/tasks/test_auto_resolve_issues.py @@ -1,12 +1,12 @@ from datetime import timedelta from time import time +from unittest.mock import patch from django.utils import timezone from sentry.models import Group, GroupStatus from sentry.tasks.auto_resolve_issues import schedule_auto_resolution from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class ScheduleAutoResolutionTest(TestCase): diff --git a/tests/sentry/tasks/test_beacon.py b/tests/sentry/tasks/test_beacon.py index 9999cd3087932f..8cdfe8d28eb420 100644 --- a/tests/sentry/tasks/test_beacon.py +++ b/tests/sentry/tasks/test_beacon.py @@ -1,4 +1,5 @@ import platform +from unittest.mock import patch from uuid import uuid4 import responses @@ -9,7 +10,6 @@ from sentry.tasks.beacon import BEACON_URL, send_beacon, send_beacon_metric from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class SendBeaconTest(TestCase): diff --git a/tests/sentry/tasks/test_check_auth.py b/tests/sentry/tasks/test_check_auth.py index d933b5cc8f793a..66c8edcd3ab405 100644 --- a/tests/sentry/tasks/test_check_auth.py +++ b/tests/sentry/tasks/test_check_auth.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import patch from django.utils import timezone @@ -7,7 +8,6 @@ from sentry.models import AuthIdentity, AuthProvider, OrganizationMember from sentry.tasks.check_auth import AUTH_CHECK_INTERVAL, check_auth, check_auth_identity from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class CheckAuthTest(TestCase): diff --git a/tests/sentry/tasks/test_clear_expired_snoozes.py b/tests/sentry/tasks/test_clear_expired_snoozes.py index 3a2811e3e9b197..2172e2768349d3 100644 --- a/tests/sentry/tasks/test_clear_expired_snoozes.py +++ b/tests/sentry/tasks/test_clear_expired_snoozes.py @@ -1,11 +1,11 @@ from datetime import timedelta +from unittest.mock import patch from django.utils import timezone from sentry.models import Group, GroupSnooze, GroupStatus from sentry.tasks.clear_expired_snoozes import clear_expired_snoozes from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class ClearExpiredSnoozesTest(TestCase): diff --git a/tests/sentry/tasks/test_commits.py b/tests/sentry/tasks/test_commits.py index c2ab25b6b7c2de..6beff18c208eb5 100644 --- a/tests/sentry/tasks/test_commits.py +++ b/tests/sentry/tasks/test_commits.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail from sentry.app import locks @@ -13,7 +15,6 @@ ) from sentry.tasks.commits import fetch_commits, handle_invalid_identity from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from social_auth.models import UserSocialAuth diff --git a/tests/sentry/tasks/test_digests.py b/tests/sentry/tasks/test_digests.py index 97f3c56ebdf300..3d0797c45c6552 100644 --- a/tests/sentry/tasks/test_digests.py +++ b/tests/sentry/tasks/test_digests.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core import mail import sentry @@ -7,7 +9,6 @@ from sentry.tasks.digests import deliver_digest from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch class DeliverDigestTest(TestCase): diff --git a/tests/sentry/tasks/test_enqueue_scheduled_jobs.py b/tests/sentry/tasks/test_enqueue_scheduled_jobs.py index dd290b0d35af25..f87816277563d7 100644 --- a/tests/sentry/tasks/test_enqueue_scheduled_jobs.py +++ b/tests/sentry/tasks/test_enqueue_scheduled_jobs.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import patch import pytest from django.core.exceptions import ValidationError @@ -8,7 +9,6 @@ from sentry.models.scheduledjob import schedule_jobs from sentry.tasks.scheduler import enqueue_scheduled_jobs from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class EnqueueScheduledJobsTest(TestCase): diff --git a/tests/sentry/tasks/test_groupowner.py b/tests/sentry/tasks/test_groupowner.py index 40eb7b533a8957..64f91ee6b26cb2 100644 --- a/tests/sentry/tasks/test_groupowner.py +++ b/tests/sentry/tasks/test_groupowner.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.utils import timezone from sentry.models import GroupRelease, Repository @@ -6,7 +8,6 @@ from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils.committers import get_frame_paths, get_serialized_event_file_committers -from sentry.utils.compat.mock import patch class TestGroupOwners(TestCase): diff --git a/tests/sentry/tasks/test_low_priority_symbolication.py b/tests/sentry/tasks/test_low_priority_symbolication.py index 242fe58720e305..da56b03a96fc96 100644 --- a/tests/sentry/tasks/test_low_priority_symbolication.py +++ b/tests/sentry/tasks/test_low_priority_symbolication.py @@ -1,5 +1,6 @@ from datetime import datetime from typing import TYPE_CHECKING, Any, Generator +from unittest import mock import pytest from freezegun import freeze_time @@ -19,7 +20,6 @@ excessive_event_rate, ) from sentry.testutils.helpers.task_runner import TaskRunner -from sentry.utils.compat import mock from sentry.utils.services import LazyServiceWrapper if TYPE_CHECKING: diff --git a/tests/sentry/tasks/test_merge.py b/tests/sentry/tasks/test_merge.py index 33a38926391bff..cad20519db0d6f 100644 --- a/tests/sentry/tasks/test_merge.py +++ b/tests/sentry/tasks/test_merge.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from sentry import eventstore, eventstream from sentry.models import Group, GroupEnvironment, GroupMeta, GroupRedirect, UserReport from sentry.similarity import _make_index_backend @@ -5,7 +7,6 @@ from sentry.testutils import TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import redis -from sentry.utils.compat.mock import patch # Use the default redis client as a cluster client in the similarity index index = _make_index_backend(redis.clusters.get("default").get_local_client(0)) diff --git a/tests/sentry/tasks/test_options.py b/tests/sentry/tasks/test_options.py index 5f6f67d4e26476..c82f274ae88131 100644 --- a/tests/sentry/tasks/test_options.py +++ b/tests/sentry/tasks/test_options.py @@ -1,10 +1,10 @@ from datetime import timedelta +from unittest.mock import patch from sentry.models import Option from sentry.options import default_manager, default_store from sentry.tasks.options import sync_options from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class SyncOptionsTest(TestCase): diff --git a/tests/sentry/tasks/test_relay.py b/tests/sentry/tasks/test_relay.py index d644b4fbf64715..dfb6dbd9e5881e 100644 --- a/tests/sentry/tasks/test_relay.py +++ b/tests/sentry/tasks/test_relay.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + import pytest from sentry.models import ProjectKey, ProjectOption from sentry.relay.projectconfig_cache.redis import RedisProjectConfigCache from sentry.relay.projectconfig_debounce_cache.redis import RedisProjectConfigDebounceCache from sentry.tasks.relay import schedule_update_config_cache -from sentry.utils.compat.mock import patch def _cache_keys_for_project(project): diff --git a/tests/sentry/tasks/test_reports.py b/tests/sentry/tasks/test_reports.py index d9832c5c157063..567fbd2f3d465c 100644 --- a/tests/sentry/tasks/test_reports.py +++ b/tests/sentry/tasks/test_reports.py @@ -1,6 +1,7 @@ import copy import functools from datetime import datetime, timedelta +from unittest import mock import pytest import pytz @@ -37,7 +38,7 @@ from sentry.testutils.cases import OutcomesSnubaTest, SnubaTestCase, TestCase from sentry.testutils.factories import DEFAULT_EVENT_DATA from sentry.testutils.helpers.datetime import iso_format -from sentry.utils.compat import map, mock +from sentry.utils.compat import map from sentry.utils.dates import floor_to_utc_day, to_datetime, to_timestamp from sentry.utils.outcomes import Outcome diff --git a/tests/sentry/tasks/test_sentry_apps.py b/tests/sentry/tasks/test_sentry_apps.py index ce62dde8fda1e2..97f78858090c9b 100644 --- a/tests/sentry/tasks/test_sentry_apps.py +++ b/tests/sentry/tasks/test_sentry_apps.py @@ -1,4 +1,5 @@ from collections import namedtuple +from unittest.mock import patch import pytest from celery import Task @@ -25,7 +26,6 @@ from sentry.testutils.helpers.eventprocessing import write_event_to_cache from sentry.testutils.helpers.faux import faux from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry.utils.http import absolute_uri from sentry.utils.sentryappwebhookrequests import SentryAppWebhookRequestsBuffer diff --git a/tests/sentry/tasks/test_servicehooks.py b/tests/sentry/tasks/test_servicehooks.py index 3722cee8d06c63..40b10d82d83450 100644 --- a/tests/sentry/tasks/test_servicehooks.py +++ b/tests/sentry/tasks/test_servicehooks.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import responses from sentry.tasks.servicehooks import get_payload_v0, process_service_hook @@ -5,7 +7,6 @@ from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.testutils.helpers.faux import faux from sentry.utils import json -from sentry.utils.compat.mock import patch class DictContaining: diff --git a/tests/sentry/tasks/test_store.py b/tests/sentry/tasks/test_store.py index d4409350352eb1..52c0800633cfda 100644 --- a/tests/sentry/tasks/test_store.py +++ b/tests/sentry/tasks/test_store.py @@ -1,4 +1,5 @@ from time import time +from unittest import mock import pytest from django.test.utils import override_settings @@ -12,7 +13,6 @@ save_event, time_synthetic_monitoring_event, ) -from sentry.utils.compat import mock EVENT_ID = "cc3e6c2bb6b6498097f336d1e6979f4b" diff --git a/tests/sentry/tasks/test_symbolication.py b/tests/sentry/tasks/test_symbolication.py index c0d42298c3e319..2542e92e797782 100644 --- a/tests/sentry/tasks/test_symbolication.py +++ b/tests/sentry/tasks/test_symbolication.py @@ -1,3 +1,5 @@ +from unittest import mock + import pytest from sentry.plugins.base.v2 import Plugin2 @@ -9,7 +11,6 @@ ) from sentry.testutils.helpers.options import override_options from sentry.testutils.helpers.task_runner import TaskRunner -from sentry.utils.compat import mock EVENT_ID = "cc3e6c2bb6b6498097f336d1e6979f4b" diff --git a/tests/sentry/templatetags/test_sentry_plugins.py b/tests/sentry/templatetags/test_sentry_plugins.py index 33d4ec18c637c5..756300a10c02b2 100644 --- a/tests/sentry/templatetags/test_sentry_plugins.py +++ b/tests/sentry/templatetags/test_sentry_plugins.py @@ -1,8 +1,9 @@ +from unittest.mock import MagicMock + from django.template import engines from sentry.plugins.base.v2 import Plugin2 from sentry.testutils import PluginTestCase -from sentry.utils.compat.mock import MagicMock class SamplePlugin(Plugin2): diff --git a/tests/sentry/test_constants.py b/tests/sentry/test_constants.py index 966af1882fc05d..35e782fc8ab049 100644 --- a/tests/sentry/test_constants.py +++ b/tests/sentry/test_constants.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from sentry.constants import ( INTEGRATION_ID_TO_PLATFORM_DATA, get_integration_id_for_event, get_integration_id_for_marketing_slug, ) -from sentry.utils.compat.mock import patch mock_integration_ids = { "java": {}, diff --git a/tests/sentry/test_http.py b/tests/sentry/test_http.py index 12ae7581710e22..96bc6b50d693da 100644 --- a/tests/sentry/test_http.py +++ b/tests/sentry/test_http.py @@ -1,5 +1,6 @@ import platform import tempfile +from unittest.mock import patch import pytest import responses @@ -8,7 +9,6 @@ from sentry import http from sentry.testutils.helpers import override_blacklist -from sentry.utils.compat.mock import patch @responses.activate diff --git a/tests/sentry/testutils/helpers/test_faux.py b/tests/sentry/testutils/helpers/test_faux.py index e66bbd19b9bdc1..c446b206dcdcda 100644 --- a/tests/sentry/testutils/helpers/test_faux.py +++ b/tests/sentry/testutils/helpers/test_faux.py @@ -1,7 +1,7 @@ from unittest import TestCase +from unittest.mock import patch from sentry.testutils.helpers.faux import faux -from sentry.utils.compat.mock import patch def fakefunc(*args, **kwargs): diff --git a/tests/sentry/tsdb/test_base.py b/tests/sentry/tsdb/test_base.py index 60928c7fdc345b..b36b6b08b5c8ac 100644 --- a/tests/sentry/tsdb/test_base.py +++ b/tests/sentry/tsdb/test_base.py @@ -1,11 +1,10 @@ import itertools from datetime import datetime, timedelta -from unittest import TestCase +from unittest import TestCase, mock import pytz from sentry.tsdb.base import ONE_DAY, ONE_HOUR, ONE_MINUTE, BaseTSDB -from sentry.utils.compat import mock from sentry.utils.dates import to_timestamp diff --git a/tests/sentry/utils/email/test_message_builder.py b/tests/sentry/utils/email/test_message_builder.py index 5eecad9fbcff77..a22afb3cf76d95 100644 --- a/tests/sentry/utils/email/test_message_builder.py +++ b/tests/sentry/utils/email/test_message_builder.py @@ -1,11 +1,11 @@ import functools +from unittest.mock import patch from django.core import mail from sentry import options from sentry.models import GroupEmailThread, User, UserEmail, UserOption from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.email import MessageBuilder from sentry.utils.email.faker import create_fake_email diff --git a/tests/sentry/utils/email/test_send_mail.py b/tests/sentry/utils/email/test_send_mail.py index a113ca9d258823..469bb6180984a4 100644 --- a/tests/sentry/utils/email/test_send_mail.py +++ b/tests/sentry/utils/email/test_send_mail.py @@ -1,5 +1,6 @@ +from unittest.mock import patch + from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.email import send_mail diff --git a/tests/sentry/utils/http/tests.py b/tests/sentry/utils/http/tests.py index b4853421d36076..8a48c5d7064105 100644 --- a/tests/sentry/utils/http/tests.py +++ b/tests/sentry/utils/http/tests.py @@ -1,4 +1,5 @@ import unittest +from unittest import mock from django.http import HttpRequest from exam import fixture @@ -6,7 +7,6 @@ from sentry import options from sentry.models import Project from sentry.testutils import TestCase -from sentry.utils.compat import mock from sentry.utils.http import ( absolute_uri, get_origins, diff --git a/tests/sentry/utils/locking/test_lock.py b/tests/sentry/utils/locking/test_lock.py index bd145cdf97b382..613d91849bc33c 100644 --- a/tests/sentry/utils/locking/test_lock.py +++ b/tests/sentry/utils/locking/test_lock.py @@ -1,9 +1,9 @@ import unittest +from unittest import mock from unittest.mock import call, patch import pytest -from sentry.utils.compat import mock from sentry.utils.locking import UnableToAcquireLock from sentry.utils.locking.backends import LockBackend from sentry.utils.locking.lock import Lock diff --git a/tests/sentry/utils/test_committers.py b/tests/sentry/utils/test_committers.py index 623feff067e734..86504ab968abdf 100644 --- a/tests/sentry/utils/test_committers.py +++ b/tests/sentry/utils/test_committers.py @@ -1,5 +1,6 @@ import unittest from datetime import timedelta +from unittest.mock import Mock from uuid import uuid4 from django.utils import timezone @@ -17,7 +18,6 @@ score_path_match_length, tokenize_path, ) -from sentry.utils.compat.mock import Mock # TODO(lb): Tests are still needed for _get_committers and _get_event_file_commiters diff --git a/tests/sentry/utils/test_concurrent.py b/tests/sentry/utils/test_concurrent.py index a205295cb23976..eb66d418d29f39 100644 --- a/tests/sentry/utils/test_concurrent.py +++ b/tests/sentry/utils/test_concurrent.py @@ -3,10 +3,10 @@ from contextlib import contextmanager from queue import Full from threading import Event +from unittest import mock import pytest -from sentry.utils.compat import mock from sentry.utils.concurrent import ( FutureSet, SynchronousExecutor, diff --git a/tests/sentry/utils/test_cursors.py b/tests/sentry/utils/test_cursors.py index 831e514c6f12b5..d3ee7c03e3f683 100644 --- a/tests/sentry/utils/test_cursors.py +++ b/tests/sentry/utils/test_cursors.py @@ -1,6 +1,6 @@ import math +from unittest.mock import Mock -from sentry.utils.compat.mock import Mock from sentry.utils.cursors import Cursor, build_cursor diff --git a/tests/sentry/utils/test_metrics.py b/tests/sentry/utils/test_metrics.py index ed0a4c42b2a691..213c7d980c4c19 100644 --- a/tests/sentry/utils/test_metrics.py +++ b/tests/sentry/utils/test_metrics.py @@ -1,7 +1,8 @@ +from unittest import mock + import pytest from sentry.utils import metrics -from sentry.utils.compat import mock def test_timer_success(): diff --git a/tests/sentry/utils/test_redis.py b/tests/sentry/utils/test_redis.py index 320dc42de1db9e..fba388d1d4176b 100644 --- a/tests/sentry/utils/test_redis.py +++ b/tests/sentry/utils/test_redis.py @@ -1,12 +1,11 @@ import functools import logging -from unittest import TestCase +from unittest import TestCase, mock import pytest from django.utils.functional import SimpleLazyObject from sentry.exceptions import InvalidConfiguration -from sentry.utils.compat import mock from sentry.utils.redis import ( ClusterManager, _RedisCluster, diff --git a/tests/sentry/utils/test_request_cache.py b/tests/sentry/utils/test_request_cache.py index 78a2a5c1fe1c94..da929e60300e29 100644 --- a/tests/sentry/utils/test_request_cache.py +++ b/tests/sentry/utils/test_request_cache.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from django.core.handlers.wsgi import WSGIHandler from django.core.signals import request_finished from django.http import HttpRequest @@ -5,7 +7,6 @@ from sentry import app from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.request_cache import clear_cache, request_cache diff --git a/tests/sentry/utils/test_retries.py b/tests/sentry/utils/test_retries.py index 20a97c72ae2f47..503774df060a82 100644 --- a/tests/sentry/utils/test_retries.py +++ b/tests/sentry/utils/test_retries.py @@ -1,8 +1,7 @@ -from unittest import TestCase +from unittest import TestCase, mock import pytest -from sentry.utils.compat import mock from sentry.utils.retries import ConditionalRetryPolicy, RetryException, TimedRetryPolicy diff --git a/tests/sentry/utils/test_safe.py b/tests/sentry/utils/test_safe.py index 2aa9c61915c078..711f3ddcbde7d1 100644 --- a/tests/sentry/utils/test_safe.py +++ b/tests/sentry/utils/test_safe.py @@ -1,12 +1,12 @@ import unittest from collections import OrderedDict from functools import partial +from unittest.mock import Mock, patch import pytest from sentry.testutils import TestCase from sentry.utils.canonical import CanonicalKeyDict -from sentry.utils.compat.mock import Mock, patch from sentry.utils.safe import ( get_path, safe_execute, diff --git a/tests/sentry/utils/test_snuba.py b/tests/sentry/utils/test_snuba.py index fa79ea10536f9c..df20ecca6aa869 100644 --- a/tests/sentry/utils/test_snuba.py +++ b/tests/sentry/utils/test_snuba.py @@ -1,5 +1,6 @@ import unittest from datetime import datetime, timedelta +from unittest import mock import pytest import pytz @@ -7,7 +8,6 @@ from sentry.models import GroupRelease, Project, Release from sentry.testutils import TestCase -from sentry.utils.compat import mock from sentry.utils.snuba import ( Dataset, SnubaQueryParams, diff --git a/tests/sentry/utils/test_urllib3_timeout.py b/tests/sentry/utils/test_urllib3_timeout.py index fef2cd586a6229..744db7271ecfb7 100644 --- a/tests/sentry/utils/test_urllib3_timeout.py +++ b/tests/sentry/utils/test_urllib3_timeout.py @@ -1,8 +1,9 @@ +from unittest import mock + import pytest from urllib3 import HTTPConnectionPool from urllib3.exceptions import HTTPError, ReadTimeoutError -from sentry.utils.compat import mock from sentry.utils.snuba import RetrySkipTimeout diff --git a/tests/sentry/web/api/tests.py b/tests/sentry/web/api/tests.py index 9335b4e7057edd..f77737189ee4ca 100644 --- a/tests/sentry/web/api/tests.py +++ b/tests/sentry/web/api/tests.py @@ -1,9 +1,10 @@ +from unittest import mock + from django.urls import reverse from exam import fixture from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat import mock class CrossDomainXmlTest(TestCase): diff --git a/tests/sentry/web/frontend/test_auth_login.py b/tests/sentry/web/frontend/test_auth_login.py index d3a64a848042e2..741910f278ec7d 100644 --- a/tests/sentry/web/frontend/test_auth_login.py +++ b/tests/sentry/web/frontend/test_auth_login.py @@ -1,3 +1,4 @@ +from unittest import mock from urllib.parse import urlencode import pytest @@ -12,7 +13,6 @@ from sentry.models import OrganizationMember, User from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat import mock # TODO(dcramer): need tests for SSO behavior and single org behavior diff --git a/tests/sentry/web/frontend/test_auth_oauth2.py b/tests/sentry/web/frontend/test_auth_oauth2.py index 958cd43e53f6a1..9247423b906c41 100644 --- a/tests/sentry/web/frontend/test_auth_oauth2.py +++ b/tests/sentry/web/frontend/test_auth_oauth2.py @@ -1,4 +1,5 @@ from collections import namedtuple +from unittest import mock from urllib.parse import parse_qs, urlencode, urlparse from django.urls import reverse @@ -8,7 +9,6 @@ from sentry.models import AuthProvider from sentry.testutils import AuthProviderTestCase from sentry.utils import json -from sentry.utils.compat import mock class DummyOAuth2Login(OAuth2Login): diff --git a/tests/sentry/web/frontend/test_auth_organization_login.py b/tests/sentry/web/frontend/test_auth_organization_login.py index da0044b21c9642..df71e06e213d2c 100644 --- a/tests/sentry/web/frontend/test_auth_organization_login.py +++ b/tests/sentry/web/frontend/test_auth_organization_login.py @@ -1,3 +1,4 @@ +from unittest import mock from urllib.parse import urlencode from django.test import override_settings @@ -16,7 +17,6 @@ from sentry.testutils import AuthProviderTestCase from sentry.testutils.helpers import with_feature from sentry.utils import json -from sentry.utils.compat import mock # TODO(dcramer): this is an integration test and repeats tests from diff --git a/tests/sentry/web/frontend/test_auth_saml2.py b/tests/sentry/web/frontend/test_auth_saml2.py index b5f5d2df2379ca..46f94bbfd1ad3a 100644 --- a/tests/sentry/web/frontend/test_auth_saml2.py +++ b/tests/sentry/web/frontend/test_auth_saml2.py @@ -1,4 +1,5 @@ import base64 +from unittest import mock from urllib.parse import parse_qs, urlencode, urlparse import pytest @@ -12,7 +13,7 @@ from sentry.models import AuditLogEntry, AuditLogEntryEvent, AuthProvider, Organization from sentry.testutils import AuthProviderTestCase from sentry.testutils.helpers import Feature -from sentry.utils.compat import map, mock +from sentry.utils.compat import map dummy_provider_config = { "idp": { diff --git a/tests/sentry/web/frontend/test_js_sdk_loader.py b/tests/sentry/web/frontend/test_js_sdk_loader.py index 4264ea08a9b643..0a253f519792fd 100644 --- a/tests/sentry/web/frontend/test_js_sdk_loader.py +++ b/tests/sentry/web/frontend/test_js_sdk_loader.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from django.conf import settings from django.urls import reverse from exam import fixture from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch class JavaScriptSdkLoaderTest(TestCase): diff --git a/tests/sentry/web/frontend/test_mailgun_inbound_webhook.py b/tests/sentry/web/frontend/test_mailgun_inbound_webhook.py index 0677217e4703c3..8e66b8d4316af8 100644 --- a/tests/sentry/web/frontend/test_mailgun_inbound_webhook.py +++ b/tests/sentry/web/frontend/test_mailgun_inbound_webhook.py @@ -1,7 +1,8 @@ +from unittest import mock + from django.urls import reverse from sentry.testutils import TestCase -from sentry.utils.compat import mock from sentry.utils.email import group_id_to_email body_plain = "foo bar" diff --git a/tests/sentry/web/frontend/test_msteams_extension.py b/tests/sentry/web/frontend/test_msteams_extension.py index 16b5c48708eb92..36c3fde3d80e65 100644 --- a/tests/sentry/web/frontend/test_msteams_extension.py +++ b/tests/sentry/web/frontend/test_msteams_extension.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from django.core.signing import SignatureExpired from sentry.models import OrganizationMember from sentry.testutils import TestCase -from sentry.utils.compat.mock import patch from sentry.utils.signing import sign from sentry.web.frontend.msteams_extension_configuration import MsTeamsExtensionConfigurationView diff --git a/tests/sentry/web/frontend/test_organization_auth_settings.py b/tests/sentry/web/frontend/test_organization_auth_settings.py index ef37f726089964..b067016b975208 100644 --- a/tests/sentry/web/frontend/test_organization_auth_settings.py +++ b/tests/sentry/web/frontend/test_organization_auth_settings.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + import pytest from django.db import models from django.urls import reverse @@ -14,7 +16,6 @@ SentryAppInstallationForProvider, ) from sentry.testutils import AuthProviderTestCase, PermissionTestCase -from sentry.utils.compat.mock import patch class OrganizationAuthSettingsPermissionTest(PermissionTestCase): diff --git a/tests/sentry/web/frontend/test_release_webhook.py b/tests/sentry/web/frontend/test_release_webhook.py index 07a51554134f36..a095870ac0384d 100644 --- a/tests/sentry/web/frontend/test_release_webhook.py +++ b/tests/sentry/web/frontend/test_release_webhook.py @@ -1,5 +1,6 @@ import hmac from hashlib import sha256 +from unittest.mock import patch from django.urls import reverse from exam import fixture @@ -7,7 +8,6 @@ from sentry.models import ProjectOption from sentry.testutils import TestCase from sentry.utils import json -from sentry.utils.compat.mock import patch class ReleaseWebhookTestBase(TestCase): diff --git a/tests/sentry_plugins/amazon_sqs/test_plugin.py b/tests/sentry_plugins/amazon_sqs/test_plugin.py index e081468f688d21..a46fe74e15987b 100644 --- a/tests/sentry_plugins/amazon_sqs/test_plugin.py +++ b/tests/sentry_plugins/amazon_sqs/test_plugin.py @@ -1,9 +1,10 @@ +from unittest.mock import patch + from botocore.client import ClientError from exam import fixture from sentry.testutils import PluginTestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry_plugins.amazon_sqs.plugin import AmazonSQSPlugin diff --git a/tests/sentry_plugins/github/test_provider.py b/tests/sentry_plugins/github/test_provider.py index aecf01b0b034d5..8b56a7e5bd3af7 100644 --- a/tests/sentry_plugins/github/test_provider.py +++ b/tests/sentry_plugins/github/test_provider.py @@ -1,10 +1,11 @@ +from unittest.mock import patch + import responses from exam import fixture from sentry.models import Integration, OrganizationIntegration, Repository from sentry.testutils import PluginTestCase from sentry.utils import json -from sentry.utils.compat.mock import patch from sentry_plugins.github.client import GitHubAppsClient, GitHubClient from sentry_plugins.github.plugin import GitHubAppsRepositoryProvider, GitHubRepositoryProvider from sentry_plugins.github.testutils import ( diff --git a/tests/sentry_plugins/heroku/test_plugin.py b/tests/sentry_plugins/heroku/test_plugin.py index 39d8591aabff48..2eea9674131814 100644 --- a/tests/sentry_plugins/heroku/test_plugin.py +++ b/tests/sentry_plugins/heroku/test_plugin.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import Mock, patch from django.utils import timezone @@ -15,7 +16,6 @@ User, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock, patch from sentry_plugins.heroku.plugin import HerokuReleaseHook diff --git a/tests/sentry_plugins/test_client.py b/tests/sentry_plugins/test_client.py index 5cb556e382c2ad..a15ebda19867ad 100644 --- a/tests/sentry_plugins/test_client.py +++ b/tests/sentry_plugins/test_client.py @@ -1,3 +1,5 @@ +from unittest.mock import Mock + import pytest import responses @@ -8,7 +10,6 @@ UnsupportedResponseType, ) from sentry.testutils import TestCase -from sentry.utils.compat.mock import Mock from sentry_plugins.client import ApiClient, AuthApiClient diff --git a/tests/snuba/api/endpoints/test_group_details.py b/tests/snuba/api/endpoints/test_group_details.py index 0d505cb6a05255..eba69edfa304d0 100644 --- a/tests/snuba/api/endpoints/test_group_details.py +++ b/tests/snuba/api/endpoints/test_group_details.py @@ -1,10 +1,11 @@ +from unittest import mock + from rest_framework.exceptions import ErrorDetail from sentry.models import Environment, GroupInboxReason, Release from sentry.models.groupinbox import add_group_to_inbox, remove_group_from_inbox from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class GroupDetailsTest(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/endpoints/test_organization_eventid.py b/tests/snuba/api/endpoints/test_organization_eventid.py index f91c7ae910a016..47c1d5ed43788f 100644 --- a/tests/snuba/api/endpoints/test_organization_eventid.py +++ b/tests/snuba/api/endpoints/test_organization_eventid.py @@ -1,8 +1,9 @@ +from unittest.mock import patch + from django.urls import NoReverseMatch, reverse from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch class EventIdLookupEndpointTest(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/endpoints/test_organization_events_facets.py b/tests/snuba/api/endpoints/test_organization_events_facets.py index a1e36bf6ae9d30..f14ecc0d2cfb01 100644 --- a/tests/snuba/api/endpoints/test_organization_events_facets.py +++ b/tests/snuba/api/endpoints/test_organization_events_facets.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest import mock from uuid import uuid4 from django.urls import reverse @@ -8,7 +9,6 @@ from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class OrganizationEventsFacetsEndpointTest(SnubaTestCase, APITestCase): diff --git a/tests/snuba/api/endpoints/test_organization_events_meta.py b/tests/snuba/api/endpoints/test_organization_events_meta.py index 8368b50a9a50e0..3bd9596ee70c75 100644 --- a/tests/snuba/api/endpoints/test_organization_events_meta.py +++ b/tests/snuba/api/endpoints/test_organization_events_meta.py @@ -1,10 +1,11 @@ +from unittest import mock + from django.urls import reverse from pytz import utc from rest_framework.exceptions import ParseError from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class OrganizationEventsMetaEndpoint(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/endpoints/test_organization_events_stats.py b/tests/snuba/api/endpoints/test_organization_events_stats.py index 9a01bffcb4961f..d1d4d86e57583a 100644 --- a/tests/snuba/api/endpoints/test_organization_events_stats.py +++ b/tests/snuba/api/endpoints/test_organization_events_stats.py @@ -1,5 +1,6 @@ import uuid from datetime import timedelta +from unittest import mock, zip from uuid import uuid4 import dateutil.parser as parse_date @@ -12,7 +13,6 @@ from sentry.snuba.discover import OTHER_KEY from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock, zip from sentry.utils.samples import load_data diff --git a/tests/snuba/api/endpoints/test_organization_events_v2.py b/tests/snuba/api/endpoints/test_organization_events_v2.py index 936b431493f53c..cb3ac593923f4e 100644 --- a/tests/snuba/api/endpoints/test_organization_events_v2.py +++ b/tests/snuba/api/endpoints/test_organization_events_v2.py @@ -1,4 +1,5 @@ from base64 import b64encode +from unittest import mock, zip import pytest from django.urls import reverse @@ -28,7 +29,6 @@ from sentry.testutils.helpers import parse_link_header from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat import mock, zip from sentry.utils.samples import load_data from sentry.utils.snuba import QueryExecutionError, QueryIllegalTypeOfArgument, RateLimitExceeded diff --git a/tests/snuba/api/endpoints/test_organization_group_index.py b/tests/snuba/api/endpoints/test_organization_group_index.py index 8dda8e94b90949..b0260693d6889d 100644 --- a/tests/snuba/api/endpoints/test_organization_group_index.py +++ b/tests/snuba/api/endpoints/test_organization_group_index.py @@ -1,4 +1,5 @@ from datetime import timedelta +from unittest.mock import Mock, patch from uuid import uuid4 from dateutil.parser import parse as parse_datetime @@ -48,7 +49,6 @@ from sentry.testutils.helpers import parse_link_header from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat.mock import Mock, patch class GroupListTest(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/endpoints/test_organization_tags.py b/tests/snuba/api/endpoints/test_organization_tags.py index 6e2d913dd5b67a..9393e73c822d54 100644 --- a/tests/snuba/api/endpoints/test_organization_tags.py +++ b/tests/snuba/api/endpoints/test_organization_tags.py @@ -1,8 +1,9 @@ +from unittest import mock + from django.urls import reverse from sentry.testutils import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock class OrganizationTagsTest(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/endpoints/test_project_group_index.py b/tests/snuba/api/endpoints/test_project_group_index.py index a5b9e43faa6258..083b296e5039bf 100644 --- a/tests/snuba/api/endpoints/test_project_group_index.py +++ b/tests/snuba/api/endpoints/test_project_group_index.py @@ -1,5 +1,6 @@ import time from datetime import timedelta +from unittest.mock import Mock, patch from urllib.parse import quote from uuid import uuid4 @@ -33,7 +34,6 @@ from sentry.testutils.helpers import parse_link_header from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.utils import json -from sentry.utils.compat.mock import Mock, patch class GroupListTest(APITestCase, SnubaTestCase): diff --git a/tests/snuba/api/serializers/test_group.py b/tests/snuba/api/serializers/test_group.py index 90e393fdb54afe..cdddd347ec6b61 100644 --- a/tests/snuba/api/serializers/test_group.py +++ b/tests/snuba/api/serializers/test_group.py @@ -1,5 +1,7 @@ import time from datetime import timedelta +from unittest import mock +from unittest.mock import patch import pytz from django.utils import timezone @@ -27,8 +29,6 @@ from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.types.integrations import ExternalProviders from sentry.utils.cache import cache -from sentry.utils.compat import mock -from sentry.utils.compat.mock import patch from sentry.utils.hashlib import hash_values diff --git a/tests/snuba/eventstream/test_eventstream.py b/tests/snuba/eventstream/test_eventstream.py index 78e6d222ce942e..13c7da58e773c8 100644 --- a/tests/snuba/eventstream/test_eventstream.py +++ b/tests/snuba/eventstream/test_eventstream.py @@ -1,13 +1,13 @@ import logging import time from datetime import datetime, timedelta +from unittest.mock import Mock, patch from sentry.event_manager import EventManager from sentry.eventstream.kafka import KafkaEventStream from sentry.eventstream.snuba import SnubaEventStream from sentry.testutils import SnubaTestCase, TestCase from sentry.utils import json, snuba -from sentry.utils.compat.mock import Mock, patch from sentry.utils.samples import load_data diff --git a/tests/snuba/search/test_backend.py b/tests/snuba/search/test_backend.py index 874b13297590af..9ea343f2afa121 100644 --- a/tests/snuba/search/test_backend.py +++ b/tests/snuba/search/test_backend.py @@ -1,6 +1,7 @@ import uuid from datetime import datetime, timedelta from hashlib import md5 +from unittest import mock import pytest import pytz @@ -27,7 +28,6 @@ from sentry.search.snuba.executors import InvalidQueryForExecutor from sentry.testutils import SnubaTestCase, TestCase, xfail_if_not_postgres from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat import mock from sentry.utils.snuba import SENTRY_SNUBA_MAP, Dataset, SnubaError diff --git a/tests/snuba/snuba/test_query_subscription_consumer.py b/tests/snuba/snuba/test_query_subscription_consumer.py index 87fc5da0a37ac0..41eb2da6c00398 100644 --- a/tests/snuba/snuba/test_query_subscription_consumer.py +++ b/tests/snuba/snuba/test_query_subscription_consumer.py @@ -2,6 +2,7 @@ from copy import deepcopy from datetime import timedelta from unittest import mock +from unittest.mock import Mock, call from uuid import uuid4 import pytz @@ -20,7 +21,6 @@ from sentry.snuba.subscriptions import create_snuba_query, create_snuba_subscription from sentry.testutils.cases import SnubaTestCase, TestCase from sentry.utils import json -from sentry.utils.compat.mock import Mock, call class QuerySubscriptionConsumerTest(TestCase, SnubaTestCase): diff --git a/tests/snuba/tasks/test_unmerge.py b/tests/snuba/tasks/test_unmerge.py index 8acdfd5770cdf1..81d31ab973b558 100644 --- a/tests/snuba/tasks/test_unmerge.py +++ b/tests/snuba/tasks/test_unmerge.py @@ -5,6 +5,7 @@ import uuid from collections import OrderedDict from datetime import datetime, timedelta +from unittest.mock import patch import pytz from django.utils import timezone @@ -27,7 +28,6 @@ from sentry.testutils.helpers.features import with_feature from sentry.utils import redis from sentry.utils.compat import map -from sentry.utils.compat.mock import patch from sentry.utils.dates import to_timestamp # Use the default redis client as a cluster client in the similarity index diff --git a/tests/snuba/tsdb/test_tsdb_backend.py b/tests/snuba/tsdb/test_tsdb_backend.py index 0bc2872ccf3789..f02c9152e36020 100644 --- a/tests/snuba/tsdb/test_tsdb_backend.py +++ b/tests/snuba/tsdb/test_tsdb_backend.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from unittest.mock import patch import pytz @@ -7,7 +8,6 @@ from sentry.testutils.helpers.datetime import iso_format from sentry.tsdb.base import TSDBModel from sentry.tsdb.snuba import SnubaTSDB -from sentry.utils.compat.mock import patch from sentry.utils.dates import to_timestamp diff --git a/tests/symbolicator/test_minidump_full.py b/tests/symbolicator/test_minidump_full.py index 73f48e7eb54ae3..0197938385bc7e 100644 --- a/tests/symbolicator/test_minidump_full.py +++ b/tests/symbolicator/test_minidump_full.py @@ -1,5 +1,6 @@ import zipfile from io import BytesIO +from unittest.mock import patch import pytest from django.core.files.uploadedfile import SimpleUploadedFile @@ -10,7 +11,6 @@ from sentry.models import EventAttachment, File from sentry.testutils import RelayStoreHelper, TransactionTestCase from sentry.testutils.helpers.task_runner import BurstTaskRunner -from sentry.utils.compat.mock import patch from tests.symbolicator import get_fixture_path, insta_snapshot_stacktrace_data # IMPORTANT: diff --git a/tests/symbolicator/test_payload_full.py b/tests/symbolicator/test_payload_full.py index bb9806db988b46..46f57088f4318b 100644 --- a/tests/symbolicator/test_payload_full.py +++ b/tests/symbolicator/test_payload_full.py @@ -1,6 +1,7 @@ import re import zipfile from io import BytesIO +from unittest.mock import patch import pytest from django.core.files.uploadedfile import SimpleUploadedFile @@ -10,7 +11,6 @@ from sentry.models import File, ProjectDebugFile from sentry.testutils import RelayStoreHelper, TransactionTestCase from sentry.testutils.helpers.datetime import before_now, iso_format -from sentry.utils.compat.mock import patch from tests.symbolicator import get_fixture_path, insta_snapshot_stacktrace_data # IMPORTANT: diff --git a/tests/symbolicator/test_unreal_full.py b/tests/symbolicator/test_unreal_full.py index 51db95b91fe49d..31a71749befbf8 100644 --- a/tests/symbolicator/test_unreal_full.py +++ b/tests/symbolicator/test_unreal_full.py @@ -1,5 +1,6 @@ import zipfile from io import BytesIO +from unittest.mock import patch import pytest from django.core.files.uploadedfile import SimpleUploadedFile @@ -8,7 +9,6 @@ from sentry.lang.native.utils import STORE_CRASH_REPORTS_ALL from sentry.models import EventAttachment, File from sentry.testutils import RelayStoreHelper, TransactionTestCase -from sentry.utils.compat.mock import patch from tests.symbolicator import get_fixture_path # IMPORTANT: From aada5495f7256c0b5e9f80a2c217f35f269d7851 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 21 Oct 2021 16:56:32 -0700 Subject: [PATCH 2/2] fixup --- tests/sentry/api/endpoints/test_project_details.py | 2 +- tests/snuba/api/endpoints/test_organization_events_stats.py | 2 +- tests/snuba/api/endpoints/test_organization_events_v2.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sentry/api/endpoints/test_project_details.py b/tests/sentry/api/endpoints/test_project_details.py index 8e3c030320c803..af2a3a0466734e 100644 --- a/tests/sentry/api/endpoints/test_project_details.py +++ b/tests/sentry/api/endpoints/test_project_details.py @@ -1,5 +1,5 @@ from time import time -from unittest import mock, zip +from unittest import mock import pytest diff --git a/tests/snuba/api/endpoints/test_organization_events_stats.py b/tests/snuba/api/endpoints/test_organization_events_stats.py index d1d4d86e57583a..9622b383c929b7 100644 --- a/tests/snuba/api/endpoints/test_organization_events_stats.py +++ b/tests/snuba/api/endpoints/test_organization_events_stats.py @@ -1,6 +1,6 @@ import uuid from datetime import timedelta -from unittest import mock, zip +from unittest import mock from uuid import uuid4 import dateutil.parser as parse_date diff --git a/tests/snuba/api/endpoints/test_organization_events_v2.py b/tests/snuba/api/endpoints/test_organization_events_v2.py index cb3ac593923f4e..d3cf18190d9173 100644 --- a/tests/snuba/api/endpoints/test_organization_events_v2.py +++ b/tests/snuba/api/endpoints/test_organization_events_v2.py @@ -1,5 +1,5 @@ from base64 import b64encode -from unittest import mock, zip +from unittest import mock import pytest from django.urls import reverse