Remove python3-mock dependency and use unittest.mock instead

Message ID 87le8c1eb0.fsf@redhat.com
State New
Headers
Series Remove python3-mock dependency and use unittest.mock instead |

Commit Message

Dodji Seketeli Jan. 26, 2024, 12:15 p.m. UTC
  Hello,

As explained in
https://fedoraproject.org/wiki/Changes/RemovePythonMockUsage,
python-mock is now deprecated.  We ought to use mock from the python
standard library instead.

Maxwell G submitted a patch to libabigail's Fedora package in Rawhide
at https://src.fedoraproject.org/fork/gotmax23/rpms/libabigail/c/405c5046d84fc6977c75cd42a381f7eb30b3efa7.

I am applying this patch inspired from his work here.

	* configure.ac: Do not require python-mock anymore.
	* tests/mockfedabipkgdiff.in: Use unittest.mock, not mock from
	python-mock.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 configure.ac               | 2 +-
 tests/mockfedabipkgdiff.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/configure.ac b/configure.ac
index 788b5620..a94255a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -764,7 +764,7 @@  if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
 
   REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF="\
    argparse logging os re subprocess sys $URLPARSE_MODULE \
-   xdg koji mock rpm $IMPORT_MODULE tempfile mimetypes shutil six"
+   xdg koji rpm $IMPORT_MODULE tempfile mimetypes shutil six"
 
   AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
 			  [$PYTHON],
diff --git a/tests/mockfedabipkgdiff.in b/tests/mockfedabipkgdiff.in
index 1e562666..863cf7f6 100644
--- a/tests/mockfedabipkgdiff.in
+++ b/tests/mockfedabipkgdiff.in
@@ -42,7 +42,7 @@  import tempfile
 import six
 
 try:
-    from mock import patch
+    from unittest.mock import patch
 except ImportError:
     import sys
     six.print_('mock is required to run tests. Please install before running'