diff --git a/python-transaction.spec b/python-transaction.spec index da45856..b6ad27d 100644 --- a/python-transaction.spec +++ b/python-transaction.spec @@ -1,11 +1,12 @@ Name: python-transaction Version: 3.0.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Transaction management for Python License: ZPLv2.1 URL: https://pypi.io/project/transaction Source0: %pypi_source transaction +Patch1: transaction-switch-to-unittest-mock.patch BuildArch: noarch @@ -13,7 +14,6 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pytest BuildRequires: python3-zope-interface -BuildRequires: python3-mock %global _description\ @@ -32,7 +32,7 @@ Requires: python3-zope-interface %prep -%setup -q -n transaction-%{version} +%autosetup -n transaction-%{version} -p1 # Remove bundled egg-info in case it exists rm -rf %{modname}.egg-info @@ -47,7 +47,7 @@ rm -rf %{modname}.egg-info %check -PYTHONPATH=$(pwd) %{__python3} setup.py test +%pytest %files -n python3-transaction @@ -57,6 +57,10 @@ PYTHONPATH=$(pwd) %{__python3} setup.py test %changelog +* Thu Apr 21 2022 Ján ONDREJ (SAL) - 3.0.1-6 +- According to deprecation of mock switch to unittest.mock +- Use pytest macro in check section + * Fri Jan 21 2022 Fedora Release Engineering - 3.0.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/transaction-switch-to-unittest-mock.patch b/transaction-switch-to-unittest-mock.patch new file mode 100644 index 0000000..8a8888d --- /dev/null +++ b/transaction-switch-to-unittest-mock.patch @@ -0,0 +1,69 @@ +diff -ur transaction-3.0.1/setup.py transaction-3.0.1.sal/setup.py +--- transaction-3.0.1/setup.py 1970-01-01 01:00:00.000000000 +0100 ++++ transaction-3.0.1.sal/setup.py 2022-04-21 09:55:53.338715279 +0200 +@@ -25,7 +25,7 @@ + + README = _read_file('README.rst') + '\n\n' + _read_file('CHANGES.rst') + +-tests_require = ['mock'] ++tests_require = ['unittest.mock'] + + setup(name='transaction', + version=version, +diff -ur transaction-3.0.1/src/transaction/tests/test__manager.py transaction-3.0.1.sal/src/transaction/tests/test__manager.py +--- transaction-3.0.1/src/transaction/tests/test__manager.py 1970-01-01 01:00:00.000000000 +0100 ++++ transaction-3.0.1.sal/src/transaction/tests/test__manager.py 2022-04-21 09:56:53.648218742 +0200 +@@ -11,7 +11,7 @@ + # FOR A PARTICULAR PURPOSE + # + ############################################################################## +-import mock ++import unittest.mock + import unittest + + import zope.interface.verify +@@ -671,15 +671,15 @@ + # If a datamanager registers for synchonization after a + # transaction has started, we should call newTransaction so it + # can do necessry setup. +- import mock ++ import unittest.mock + from .. import TransactionManager + manager = TransactionManager() +- sync1 = mock.MagicMock() ++ sync1 = unittest.mock.MagicMock() + manager.registerSynch(sync1) + sync1.newTransaction.assert_not_called() + t = manager.begin() + sync1.newTransaction.assert_called_with(t) +- sync2 = mock.MagicMock() ++ sync2 = unittest.mock.MagicMock() + manager.registerSynch(sync2) + sync2.newTransaction.assert_called_with(t) + +@@ -746,8 +746,8 @@ + def test_sync_registration_thread_local_manager(self): + import transaction + +- sync = mock.MagicMock() +- sync2 = mock.MagicMock() ++ sync = unittest.mock.MagicMock() ++ sync2 = unittest.mock.MagicMock() + self.assertFalse(transaction.manager.registeredSynchs()) + transaction.manager.registerSynch(sync) + self.assertTrue(transaction.manager.registeredSynchs()) +diff -ur transaction-3.0.1/src/transaction.egg-info/requires.txt transaction-3.0.1.sal/src/transaction.egg-info/requires.txt +--- transaction-3.0.1/src/transaction.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 ++++ transaction-3.0.1.sal/src/transaction.egg-info/requires.txt 2022-04-21 09:56:25.300922162 +0200 +@@ -5,9 +5,9 @@ + repoze.sphinx.autointerface + + [test] +-mock ++unittest.mock + + [testing] + nose + coverage +-mock ++unittest.mock