Skip to content

Commit

Permalink
prefer unittest.mock from the standard library for Python >=3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
a-detiste committed May 23, 2024
1 parent 3863205 commit 9f07cde
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion tests/unit/http/test_async_http_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import aiounittest

from aiohttp import ClientSession
from mock import patch, AsyncMock
try:
from unittest.mock import patch, AsyncMock
except ImportError:
# Python 3.7
from mock import patch, AsyncMock
from twilio.http.async_http_client import AsyncTwilioHttpClient


Expand Down
6 changes: 5 additions & 1 deletion tests/unit/http/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import unittest
from collections import OrderedDict

from mock import Mock, patch
try:
from unittest.mock import patch, AsyncMock
except ImportError:
# Python 3.7
from mock import patch, AsyncMock
from requests import Session

from twilio.base.exceptions import TwilioRestException
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/http/test_validation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import unittest

from mock import patch, Mock
try:
from unittest.mock import patch, AsyncMock
except ImportError:
# Python 3.7
from mock import patch, AsyncMock
from requests import Request
from requests import Session

Expand Down
6 changes: 5 additions & 1 deletion tests/unit/jwt/test_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import unittest

import jwt as jwt_lib
from mock import patch
try:
from unittest.mock import patch, AsyncMock
except ImportError:
# Python 3.7
from mock import patch, AsyncMock

from twilio.jwt import Jwt, JwtDecodeError

Expand Down
6 changes: 5 additions & 1 deletion tests/unit/rest/test_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import unittest
import aiounittest

from mock import AsyncMock, Mock
try:
from unittest.mock import patch, AsyncMock
except ImportError:
# Python 3.7
from mock import patch, AsyncMock
from twilio.http.response import Response
from twilio.rest import Client

Expand Down

0 comments on commit 9f07cde

Please sign in to comment.