File remove-mock.patch of Package python-jirafs
From 9acae1e687078a1012d62641087c9d78a7be8925 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 12 Jan 2024 13:15:14 +1100
Subject: [PATCH] Switch to unittest.mock
Python 3.3+ has included mock in the standard library, under the
unittest module. Switch to using that, rather than the external mock
library. As a drive-by, stop using a deprecated assertion call in
one callsite.
Fixes #69
---
.travis.yml | 2 +-
tests/commands/base.py | 4 ++--
tests/commands/test_push.py | 2 +-
tests/test_command_result.py | 2 +-
tests/test_plugins.py | 4 ++--
tests/test_ticketfolder.py | 6 +++---
tests/test_utils.py | 2 +-
7 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 76a9d96..1bcbae1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ before_install:
- curl -fI $INTEGRATION_TESTING_URL
- pip install --upgrade setuptools
- pip install -r requirements.txt
-- pip install pytest mock behave
+- pip install pytest behave
- pip install -e .
- git config --global user.email "gitbot@adamcoddington.net"
- git config --global user.name "I'm a Robot"
diff --git a/tests/commands/base.py b/tests/commands/base.py
index e961bd8..5843c5f 100644
--- a/tests/commands/base.py
+++ b/tests/commands/base.py
@@ -1,8 +1,8 @@
import os
import tempfile
-import mock
-from mock import patch
+from unittest import mock
+from unittest.mock import patch
from jirafs.utils import run_command_method_with_kwargs
diff --git a/tests/commands/test_push.py b/tests/commands/test_push.py
index 78e7673..283dbc1 100644
--- a/tests/commands/test_push.py
+++ b/tests/commands/test_push.py
@@ -1,4 +1,4 @@
-from mock import call, patch
+from unittest.mock import call, patch
from jirafs.utils import run_command_method_with_kwargs
diff --git a/tests/test_command_result.py b/tests/test_command_result.py
index f44ec43..49ed5c9 100644
--- a/tests/test_command_result.py
+++ b/tests/test_command_result.py
@@ -1,4 +1,4 @@
-from mock import patch
+from unittest.mock import patch
from jirafs.plugin import CommandResult
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index e1af5bf..f165874 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -3,8 +3,8 @@
import shutil
import tempfile
-import mock
-from mock import patch
+from unittest import mock
+from unittest.mock import patch
from jirafs.plugin import MacroPlugin
from jirafs.utils import run_command_method_with_kwargs
diff --git a/tests/test_ticketfolder.py b/tests/test_ticketfolder.py
index f93d2b7..96ad341 100644
--- a/tests/test_ticketfolder.py
+++ b/tests/test_ticketfolder.py
@@ -4,9 +4,9 @@
import shutil
import tempfile
-import mock
+from unittest import mock
import six
-from mock import patch
+from unittest.mock import patch
from jirafs import exceptions
from jirafs.jirafieldmanager import JiraFieldManager
@@ -63,7 +63,7 @@ def test_get_fields(self):
expected_result = json.loads(self.get_asset_contents("basic.status.json"))
- self.assertEquals(actual_result, expected_result)
+ self.assertEqual(actual_result, expected_result)
def test_fetch(self):
self.ticketfolder._issue = self.rehydrate_issue("test_fetch/fetched.json")
diff --git a/tests/test_utils.py b/tests/test_utils.py
index c26246f..7c9e41e 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,6 +1,6 @@
from distutils.version import LooseVersion
-import mock
+from unittest import mock
from jirafs import utils