Browse Source

test: remove mock compat (#29501)

josh 3 years ago
parent
commit
29a0c5342b

+ 0 - 3
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

+ 2 - 2
src/sentry/testutils/cases.py

@@ -29,6 +29,8 @@ import os.path
 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.tagstore.snuba import SnubaTagStorage
 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

+ 1 - 1
src/sentry/testutils/helpers/features.py

@@ -3,10 +3,10 @@ __all__ = ["Feature", "with_feature"]
 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__)
 

+ 1 - 2
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):

+ 1 - 2
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():

+ 0 - 4
src/sentry/utils/compat/mock.py

@@ -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.

+ 1 - 1
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(

+ 2 - 1
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):

+ 1 - 1
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
 

+ 2 - 1
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
 
 

Some files were not shown because too many files changed in this diff