Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use mock that comes with Python 3

Patryk Zawadzkia040c3abacdd
diff --git a/requirements.in b/requirements.in
index 74f6eceea7..5067d163cf 100644
--- a/requirements.in
+++ b/requirements.in
@@ -33,7 +33,6 @@ jsonfield>=2.0.2
Markdown>=2.4
maxminddb
maxminddb-geolite2
-mock>=1.3.0
prices>=0.5.7
psycopg2>=2.6
purl>=0.4.1
diff --git a/requirements.txt b/requirements.txt
index f42edf49d7..e23635ec97 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -64,10 +64,8 @@ kombu==4.1.0 # via celery
markdown==2.6.9
maxminddb-geolite2==2017.803
maxminddb==1.3.0
-mock==2.0.0
oauthlib==2.0.4 # via requests-oauthlib, social-auth-core
olefile==0.44 # via pillow
-pbr==3.1.1 # via mock
pdfrw==0.4 # via weasyprint
phonenumberslite==8.8.5 # via django-phonenumber-field
pillow==4.0.0 # via django-versatileimagefield
@@ -93,7 +91,7 @@ requests==2.18.4
s3transfer==0.1.10 # via boto3
satchless==1.1.3
singledispatch==3.4.0.3 # via graphene-django
-six==1.11.0 # via cryptography, django-templated-email, elasticsearch-dsl, faker, freezegun, graphene, graphene-django, graphql-core, graphql-relay, html5lib, mock, promise, purl, python-dateutil, singledispatch, social-auth-app-django, social-auth-core, vcrpy
+six==1.11.0 # via cryptography, django-templated-email, elasticsearch-dsl, faker, freezegun, graphene, graphene-django, graphql-core, graphql-relay, html5lib, promise, purl, python-dateutil, singledispatch, social-auth-app-django, social-auth-core, vcrpy
social-auth-app-django==2.0.0
social-auth-core==1.4.0 # via social-auth-app-django
stripe==1.65.0 # via django-payments
diff --git a/tests/conftest.py b/tests/conftest.py
index fb73e5b5be..2aeccb3462 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,6 @@
from decimal import Decimal
from io import BytesIO
+from unittest.mock import MagicMock
import pytest
from django.contrib.auth.models import AnonymousUser, Group, Permission
@@ -9,7 +10,6 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.encoding import smart_text
from PIL import Image
-from mock import MagicMock
from saleor.cart import utils
from saleor.cart.models import Cart
from saleor.checkout.core import Checkout
diff --git a/tests/test_asynchronous_tasks.py b/tests/test_asynchronous_tasks.py
index 468cd11959..3de3914564 100644
--- a/tests/test_asynchronous_tasks.py
+++ b/tests/test_asynchronous_tasks.py
@@ -1,26 +1,13 @@
-import celery
-import mock
import pytest
from saleor.order.emails import (
send_order_confirmation, send_payment_confirmation)
-def dummy_task(x):
- return x+1
-
-
-def test_task_running_asynchronously_on_worker(celery_worker):
- assert dummy_task.delay(42).get(timeout=10) == 43
-
-
@pytest.mark.django_db
@pytest.mark.integration
[email protected]('saleor.order.emails.send_templated_mail')
-def test_email_sending_asynchronously(email_send, transactional_db, celery_app,
- celery_worker):
+def test_email_sending_asynchronously(
+ transactional_db, celery_app, celery_worker):
order = send_order_confirmation.delay('[email protected]', '/nowhere/to/go')
payment = send_payment_confirmation.delay('[email protected]', '/nowhere/')
order.get()
diff --git a/tests/test_cart.py b/tests/test_cart.py
index fe9d2102e0..e6a1990a14 100644
--- a/tests/test_cart.py
+++ b/tests/test_cart.py
@@ -1,5 +1,6 @@
import json
from uuid import uuid4
+from unittest.mock import MagicMock, Mock
from django.contrib.auth.models import AnonymousUser
from django.core import signing
@@ -7,7 +8,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from django.urls import reverse
from django_babel.templatetags.babel import currencyfmt
-from mock import MagicMock, Mock
from prices import Price
import pytest
from satchless.item import InsufficientStock
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index e00736dd54..29c007933d 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -1,6 +1,7 @@
+from unittest.mock import MagicMock, Mock
+
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
-from mock import MagicMock, Mock
from prices import Price
import pytest
from satchless.item import InsufficientStock
diff --git a/tests/test_core.py b/tests/test_core.py
index 459d60efee..640baa2603 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1,4 +1,5 @@
-from mock import Mock
+from unittest.mock import Mock
+
import pytest
from saleor.core.utils import (
diff --git a/tests/test_data_feeds.py b/tests/test_data_feeds.py
index cfddfccd73..94fb1fa7e7 100644
--- a/tests/test_data_feeds.py
+++ b/tests/test_data_feeds.py
@@ -1,9 +1,9 @@
import csv
from io import StringIO
+from unittest.mock import Mock, patch
from django.contrib.sites.models import Site
from django.utils.encoding import smart_text
-from mock import Mock, patch
from saleor.data_feeds.google_merchant import (
get_feed_items, item_attributes, item_google_product_category, write_feed)
diff --git a/tests/test_discounts.py b/tests/test_discounts.py
index 5c528d1a26..1932a03ffe 100644
--- a/tests/test_discounts.py
+++ b/tests/test_discounts.py
@@ -1,10 +1,10 @@
from datetime import date, datetime, timedelta
from decimal import Decimal
+from unittest.mock import Mock
+import pytest
from freezegun import freeze_time
-from mock import Mock
from prices import FixedDiscount, FractionalDiscount, Price
-import pytest
from saleor.cart.utils import get_category_variants_and_prices
from saleor.checkout.core import Checkout
diff --git a/tests/test_emails.py b/tests/test_emails.py
index 88a80bf8a8..29edee3387 100644
--- a/tests/test_emails.py
+++ b/tests/test_emails.py
@@ -1,5 +1,6 @@
+from unittest import mock
+
from django.conf import settings
-import mock
import saleor.order.emails as emails
diff --git a/tests/test_product.py b/tests/test_product.py
index 875d6efd71..2535e40bfa 100644
--- a/tests/test_product.py
+++ b/tests/test_product.py
@@ -1,10 +1,10 @@
import datetime
import json
+from unittest.mock import Mock
+import pytest
from django.urls import reverse
from django.utils.encoding import smart_text
-from mock import Mock
-import pytest
from tests.utils import filter_products_by_attribute
from saleor.cart import CartStatus, utils
diff --git a/tests/test_product_tags.py b/tests/test_product_tags.py
index 89e8bd9cdb..91458c5039 100644
--- a/tests/test_product_tags.py
+++ b/tests/test_product_tags.py
@@ -1,5 +1,6 @@
+from unittest.mock import Mock
+
from django.contrib.staticfiles.templatetags.staticfiles import static
-from mock import Mock
from saleor.product.templatetags.product_images import (
choose_placeholder, get_thumbnail, product_first_image)