From e48a9587803a0959a1fbee00f57dadbb3a9f1383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20H=C3=B6nig?= Date: Fri, 5 Jan 2018 22:23:36 +0100 Subject: [PATCH] request_test_lib.py: Move from mock to unittest.mock. This commit changes 'Mock.assert_called()' to 'assert Mock.called'. This is needed because in unittest.mock, assert_called() is only supported in Python >=3.6. --- zulip_bots/zulip_bots/request_test_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zulip_bots/zulip_bots/request_test_lib.py b/zulip_bots/zulip_bots/request_test_lib.py index 42c99a3..561d5d6 100644 --- a/zulip_bots/zulip_bots/request_test_lib.py +++ b/zulip_bots/zulip_bots/request_test_lib.py @@ -2,7 +2,7 @@ import json import requests from contextlib import contextmanager -from mock import patch +from unittest.mock import patch from typing import Any, Dict, List @@ -77,7 +77,7 @@ def mock_request_exception(): # type: () -> Any def assert_mock_called(mock_result): # type: (Any) -> None - mock_result.assert_called() + assert mock_result.called with patch('requests.get') as mock_get: mock_get.return_value = True