Remove python3-mock dependency

Merges: https://src.fedoraproject.org/rpms/pungi/pull-request/9

(cherry picked from commit 67a11d878b04bd46a0d9fb98036467bca6ffed92)
This commit is contained in:
Maxwell G 2024-01-13 01:36:36 +02:00 committed by Stepan Oksanichenko
parent 80b9add9f7
commit f4765fbe3a
Signed by: soksanichenko
GPG Key ID: AB9983172AB1E45B
2 changed files with 649 additions and 1 deletions

View File

@ -0,0 +1,644 @@
From 120a71ef208a0b7737f4b23318ea9f85ed830528 Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
Date: Fri, 12 Jan 2024 23:33:20 +0000
Subject: [PATCH] Replace deprecated mock with unittest.mock
Relates: https://fedoraproject.org/wiki/Changes/RemovePythonMockUsage
---
tests/helpers.py | 2 +-
tests/test_arch.py | 2 +-
tests/test_arguments.py | 2 +-
tests/test_buildinstall.py | 2 +-
tests/test_checks.py | 2 +-
tests/test_compose.py | 2 +-
tests/test_config.py | 2 +-
tests/test_config_validate_script.py | 2 +-
tests/test_createiso_phase.py | 2 +-
tests/test_createiso_script.py | 2 +-
tests/test_createrepophase.py | 2 +-
tests/test_extra_files_phase.py | 2 +-
tests/test_extra_isos_phase.py | 2 +-
tests/test_gather_method_deps.py | 2 +-
tests/test_gather_method_hybrid.py | 2 +-
tests/test_gather_method_nodeps.py | 2 +-
tests/test_gather_phase.py | 2 +-
tests/test_gather_source_module.py | 2 +-
tests/test_image_container_phase.py | 2 +-
tests/test_imagebuildphase.py | 2 +-
tests/test_imagechecksumphase.py | 2 +-
tests/test_initphase.py | 2 +-
tests/test_iso_wrapper.py | 2 +-
tests/test_koji_wrapper.py | 2 +-
tests/test_linker.py | 2 +-
tests/test_liveimagesphase.py | 2 +-
tests/test_livemediaphase.py | 2 +-
tests/test_media_split.py | 2 +-
tests/test_metadata.py | 2 +-
tests/test_notifier.py | 2 +-
tests/test_osbs_phase.py | 2 +-
tests/test_osbuild_phase.py | 2 +-
tests/test_ostree_installer_phase.py | 2 +-
tests/test_ostree_phase.py | 2 +-
tests/test_ostree_script.py | 2 +-
tests/test_ostree_utils.py | 2 +-
tests/test_patch_iso.py | 2 +-
tests/test_phase_base.py | 2 +-
tests/test_pkgset_common.py | 2 +-
tests/test_pkgset_pkgsets.py | 2 +-
tests/test_pkgset_source_koji.py | 2 +-
tests/test_repoclosure_phase.py | 2 +-
tests/test_runroot.py | 2 +-
tests/test_scm.py | 2 +-
tests/test_test_phase.py | 2 +-
tests/test_unified_isos.py | 2 +-
tests/test_util.py | 2 +-
47 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/tests/helpers.py b/tests/helpers.py
index b09d10a..6d3cb30 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -7,7 +7,7 @@ import shutil
import tempfile
from collections import defaultdict
-import mock
+from unittest import mock
import six
from kobo.rpmlib import parse_nvr
diff --git a/tests/test_arch.py b/tests/test_arch.py
index 5112cae..fae515d 100644
--- a/tests/test_arch.py
+++ b/tests/test_arch.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import unittest
from pungi.arch import (
diff --git a/tests/test_arguments.py b/tests/test_arguments.py
index 20bf17e..42baacf 100644
--- a/tests/test_arguments.py
+++ b/tests/test_arguments.py
@@ -1,4 +1,4 @@
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py
index 8acc83e..d2b8c55 100644
--- a/tests/test_buildinstall.py
+++ b/tests/test_buildinstall.py
@@ -6,7 +6,7 @@ try:
except ImportError:
import unittest
-import mock
+from unittest import mock
import six
from copy import copy
from six.moves import StringIO
diff --git a/tests/test_checks.py b/tests/test_checks.py
index 9d53b11..6ff46bd 100644
--- a/tests/test_checks.py
+++ b/tests/test_checks.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_compose.py b/tests/test_compose.py
index 246acc6..41abbaf 100644
--- a/tests/test_compose.py
+++ b/tests/test_compose.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_config.py b/tests/test_config.py
index 6de64ef..7d084bd 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -7,7 +7,7 @@ except ImportError:
import unittest
import six
-import mock
+from unittest import mock
from pungi import checks
from tests.helpers import load_config, PKGSET_REPOS
diff --git a/tests/test_config_validate_script.py b/tests/test_config_validate_script.py
index 4f9c64b..0933b44 100644
--- a/tests/test_config_validate_script.py
+++ b/tests/test_config_validate_script.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py
index 5cd21ad..0acb5ab 100644
--- a/tests/test_createiso_phase.py
+++ b/tests/test_createiso_phase.py
@@ -2,7 +2,7 @@
import logging
-import mock
+from unittest import mock
import six
import os
diff --git a/tests/test_createiso_script.py b/tests/test_createiso_script.py
index 3c62e15..dd0afce 100644
--- a/tests/test_createiso_script.py
+++ b/tests/test_createiso_script.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
from parameterized import parameterized
import os
diff --git a/tests/test_createrepophase.py b/tests/test_createrepophase.py
index aecff99..3c2f2ef 100644
--- a/tests/test_createrepophase.py
+++ b/tests/test_createrepophase.py
@@ -8,7 +8,7 @@ except ImportError:
import glob
import os
-import mock
+from unittest import mock
import six
from pungi.module_util import Modulemd
diff --git a/tests/test_extra_files_phase.py b/tests/test_extra_files_phase.py
index 21dc3fe..1b85be0 100644
--- a/tests/test_extra_files_phase.py
+++ b/tests/test_extra_files_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
from productmd.extra_files import ExtraFiles
diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py
index fab8aee..919ab28 100644
--- a/tests/test_extra_isos_phase.py
+++ b/tests/test_extra_isos_phase.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging
-import mock
+from unittest import mock
import six
import os
diff --git a/tests/test_gather_method_deps.py b/tests/test_gather_method_deps.py
index 77b30bc..a231681 100644
--- a/tests/test_gather_method_deps.py
+++ b/tests/test_gather_method_deps.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
from pungi.phases.gather.methods import method_deps as deps
from tests import helpers
diff --git a/tests/test_gather_method_hybrid.py b/tests/test_gather_method_hybrid.py
index b053f22..711df27 100644
--- a/tests/test_gather_method_hybrid.py
+++ b/tests/test_gather_method_hybrid.py
@@ -2,7 +2,7 @@
from collections import namedtuple
import copy
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_gather_method_nodeps.py b/tests/test_gather_method_nodeps.py
index b337fe9..02eafab 100644
--- a/tests/test_gather_method_nodeps.py
+++ b/tests/test_gather_method_nodeps.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py
index a5d5973..7ed167d 100644
--- a/tests/test_gather_phase.py
+++ b/tests/test_gather_phase.py
@@ -4,7 +4,7 @@ import copy
import json
import os
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_gather_source_module.py b/tests/test_gather_source_module.py
index 7b87400..a3482c3 100644
--- a/tests/test_gather_source_module.py
+++ b/tests/test_gather_source_module.py
@@ -5,7 +5,7 @@ try:
except ImportError:
import unittest
-import mock
+from unittest import mock
import six
from pungi.phases.gather.sources.source_module import GatherSourceModule
diff --git a/tests/test_image_container_phase.py b/tests/test_image_container_phase.py
index 246bb26..36282c2 100644
--- a/tests/test_image_container_phase.py
+++ b/tests/test_image_container_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py
index f62aa3f..2cf982d 100644
--- a/tests/test_imagebuildphase.py
+++ b/tests/test_imagebuildphase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import six
diff --git a/tests/test_imagechecksumphase.py b/tests/test_imagechecksumphase.py
index fd8a44c..2693098 100644
--- a/tests/test_imagechecksumphase.py
+++ b/tests/test_imagechecksumphase.py
@@ -4,7 +4,7 @@ try:
import unittest2 as unittest
except ImportError:
import unittest
-import mock
+from unittest import mock
import os
import tempfile
diff --git a/tests/test_initphase.py b/tests/test_initphase.py
index 2ddb82c..3298920 100644
--- a/tests/test_initphase.py
+++ b/tests/test_initphase.py
@@ -5,7 +5,7 @@ try:
import unittest2 as unittest
except ImportError:
import unittest
-import mock
+from unittest import mock
import six
diff --git a/tests/test_iso_wrapper.py b/tests/test_iso_wrapper.py
index bdea5dd..8d8255f 100644
--- a/tests/test_iso_wrapper.py
+++ b/tests/test_iso_wrapper.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import itertools
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py
index 341090f..7d3728f 100644
--- a/tests/test_koji_wrapper.py
+++ b/tests/test_koji_wrapper.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_linker.py b/tests/test_linker.py
index e81ca2f..93f1d4f 100644
--- a/tests/test_linker.py
+++ b/tests/test_linker.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import errno
import os
import stat
diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py
index af7327a..57f042c 100644
--- a/tests/test_liveimagesphase.py
+++ b/tests/test_liveimagesphase.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import six
diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py
index c416136..d255378 100644
--- a/tests/test_livemediaphase.py
+++ b/tests/test_livemediaphase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
diff --git a/tests/test_media_split.py b/tests/test_media_split.py
index f286f65..eba600d 100644
--- a/tests/test_media_split.py
+++ b/tests/test_media_split.py
@@ -4,7 +4,7 @@ try:
import unittest2 as unittest
except ImportError:
import unittest
-import mock
+from unittest import mock
from pungi import media_split
diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index a5fa10a..8aa86df 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -1,4 +1,4 @@
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_notifier.py b/tests/test_notifier.py
index 2273add..750953d 100644
--- a/tests/test_notifier.py
+++ b/tests/test_notifier.py
@@ -2,7 +2,7 @@
from datetime import datetime
import json
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py
index 5df6909..d5c9feb 100644
--- a/tests/test_osbs_phase.py
+++ b/tests/test_osbs_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import json
import copy
diff --git a/tests/test_osbuild_phase.py b/tests/test_osbuild_phase.py
index c337b60..31ee636 100644
--- a/tests/test_osbuild_phase.py
+++ b/tests/test_osbuild_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import shutil
diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py
index 1dcacd8..3d87234 100644
--- a/tests/test_ostree_installer_phase.py
+++ b/tests/test_ostree_installer_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py
index 44c623a..ca06176 100644
--- a/tests/test_ostree_phase.py
+++ b/tests/test_ostree_phase.py
@@ -2,7 +2,7 @@
import json
-import mock
+from unittest import mock
import os
diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py
index eab8415..04cc361 100644
--- a/tests/test_ostree_script.py
+++ b/tests/test_ostree_script.py
@@ -4,7 +4,7 @@
import json
import os
-import mock
+from unittest import mock
import six
import yaml
diff --git a/tests/test_ostree_utils.py b/tests/test_ostree_utils.py
index 7654101..1fe0360 100644
--- a/tests/test_ostree_utils.py
+++ b/tests/test_ostree_utils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
diff --git a/tests/test_patch_iso.py b/tests/test_patch_iso.py
index 9fe8d7b..381313a 100644
--- a/tests/test_patch_iso.py
+++ b/tests/test_patch_iso.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
try:
diff --git a/tests/test_phase_base.py b/tests/test_phase_base.py
index 5a45df3..15a7f2d 100644
--- a/tests/test_phase_base.py
+++ b/tests/test_phase_base.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_pkgset_common.py b/tests/test_pkgset_common.py
index 96f6312..8073873 100755
--- a/tests/test_pkgset_common.py
+++ b/tests/test_pkgset_common.py
@@ -2,7 +2,7 @@
import os
-import mock
+from unittest import mock
import six
from pungi.module_util import Modulemd
diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py
index 0c1256d..eff29ef 100644
--- a/tests/test_pkgset_pkgsets.py
+++ b/tests/test_pkgset_pkgsets.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import six
diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py
index 19e82e1..4b75489 100644
--- a/tests/test_pkgset_source_koji.py
+++ b/tests/test_pkgset_source_koji.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json
-import mock
+from unittest import mock
import os
import re
import six
diff --git a/tests/test_repoclosure_phase.py b/tests/test_repoclosure_phase.py
index 81e4bb5..bea7040 100644
--- a/tests/test_repoclosure_phase.py
+++ b/tests/test_repoclosure_phase.py
@@ -6,7 +6,7 @@ try:
except ImportError:
import unittest
-import mock
+from unittest import mock
import six
import pungi.phases.repoclosure as repoclosure_phase
diff --git a/tests/test_runroot.py b/tests/test_runroot.py
index 4b3f048..410a0fc 100644
--- a/tests/test_runroot.py
+++ b/tests/test_runroot.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
from pungi.runroot import Runroot
diff --git a/tests/test_scm.py b/tests/test_scm.py
index 98fd2e2..65c13f3 100644
--- a/tests/test_scm.py
+++ b/tests/test_scm.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
try:
import unittest2 as unittest
diff --git a/tests/test_test_phase.py b/tests/test_test_phase.py
index 1b6f1ad..81d9e58 100644
--- a/tests/test_test_phase.py
+++ b/tests/test_test_phase.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import pungi.phases.test as test_phase
diff --git a/tests/test_unified_isos.py b/tests/test_unified_isos.py
index 4047e5d..82bd486 100755
--- a/tests/test_unified_isos.py
+++ b/tests/test_unified_isos.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
import os
import shutil
import six
diff --git a/tests/test_util.py b/tests/test_util.py
index c22e10f..52948d4 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import argparse
-import mock
+from unittest import mock
import os
try:
--
2.43.0

View File

@ -2,7 +2,7 @@
Name: pungi
Version: 4.6.0
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Distribution compose tool
License: GPL-2.0-only
@ -10,6 +10,7 @@ URL: https://pagure.io/pungi
Source0: %{name}-%{version}.tar.bz2
Patch1: https://pagure.io/pungi/pull-request/1711.patch
Patch2: https://pagure.io/pungi/pull-request/1715.patch
Patch3: 0001-Replace-deprecated-mock-with-unittest.mock.patch
BuildRequires: make
BuildRequires: python3-pytest
@ -170,6 +171,9 @@ rm %{buildroot}%{_bindir}/pungi
* Fri Jan 19 2024 Lubomír Sedlář <lsedlar@redhat.com> - 4.6.0-3
- Stop requiring repo option in ostree phase
* Fri Jan 26 2024 Maxwell G <maxwell@gtmx.me> - 4.6.0-5
- Remove python3-mock dependency
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild