Skip to content
Snippets Groups Projects
Unverified Commit 0b311212 authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Use mock from the stdlib. (#9772)

parent f9464501
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 29 deletions
Use mock from the standard library instead of a separate package.
......@@ -23,11 +23,10 @@ ignore=W503,W504,E203,E731,E501,B007
[isort]
line_length = 88
sections=FUTURE,STDLIB,COMPAT,THIRDPARTY,TWISTED,FIRSTPARTY,TESTS,LOCALFOLDER
sections=FUTURE,STDLIB,THIRDPARTY,TWISTED,FIRSTPARTY,TESTS,LOCALFOLDER
default_section=THIRDPARTY
known_first_party = synapse
known_tests=tests
known_compat = mock
known_twisted=twisted,OpenSSL
multi_line_output=3
include_trailing_comma=true
......
......@@ -110,7 +110,7 @@ CONDITIONAL_REQUIREMENTS["mypy"] = ["mypy==0.812", "mypy-zope==0.2.13"]
# Tests assume that all optional dependencies are installed.
#
# parameterized_class decorator was introduced in parameterized 0.7.0
CONDITIONAL_REQUIREMENTS["test"] = ["mock>=2.0", "parameterized>=0.7.0"]
CONDITIONAL_REQUIREMENTS["test"] = ["parameterized>=0.7.0"]
setup(
name="matrix-synapse",
......
......@@ -16,8 +16,7 @@
import logging
import warnings
from io import StringIO
from mock import Mock
from unittest.mock import Mock
from pyperf import perf_counter
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
import pymacaroons
......
......@@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock, patch
from unittest.mock import Mock, patch
from parameterized import parameterized
......
......@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import re
from mock import Mock
from unittest.mock import Mock
from twisted.internet import defer
......
......@@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
from twisted.internet import defer
......
......@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import time
from mock import Mock
from unittest.mock import Mock
import attr
import canonicaljson
......
......@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Dict, Iterable, List, Optional, Set, Tuple, Union
from mock import Mock
from unittest.mock import Mock
import attr
......@@ -314,7 +313,8 @@ class PresenceRouterTestCase(FederatingHomeserverTestCase):
self.hs.get_federation_transport_client().send_transaction.call_args_list
)
for call in calls:
federation_transaction = call.args[0] # type: Transaction
call_args = call[0]
federation_transaction = call_args[0] # type: Transaction
# Get the sent EDUs in this transaction
edus = federation_transaction.get_dict()["edus"]
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
from synapse.api.errors import Codes, SynapseError
from synapse.rest import admin
......
from typing import List, Tuple
from mock import Mock
from unittest.mock import Mock
from synapse.api.constants import EventTypes
from synapse.events import EventBase
......
......@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Optional
from mock import Mock
from unittest.mock import Mock
from signedjson import key, sign
from signedjson.types import BaseKey, SigningKey
......
......@@ -14,8 +14,7 @@
# limitations under the License.
from collections import Counter
from mock import Mock
from unittest.mock import Mock
import synapse.api.errors
import synapse.handlers.admin
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
from twisted.internet import defer
......
......@@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
import pymacaroons
......
......@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
from synapse.handlers.cas_handler import CasResponse
......
......@@ -14,7 +14,7 @@
# limitations under the License.
from mock import Mock
from unittest.mock import Mock
import synapse
import synapse.api.errors
......
......@@ -14,7 +14,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from signedjson import key as key, sign as sign
......
......@@ -16,8 +16,7 @@
# limitations under the License.
import copy
import mock
from unittest import mock
from synapse.api.errors import SynapseError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment