diff --git a/python-pytest-shutil.changes b/python-pytest-shutil.changes index c17b022..f8d775a 100644 --- a/python-pytest-shutil.changes +++ b/python-pytest-shutil.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Mar 23 06:45:41 UTC 2022 - Steve Kowalik + +- Add patch remove-mock.patch: + * Do not use external mock. + ------------------------------------------------------------------- Fri Mar 13 12:37:42 UTC 2020 - Tomáš Chvátal diff --git a/python-pytest-shutil.spec b/python-pytest-shutil.spec index 93f60e3..90ce1da 100644 --- a/python-pytest-shutil.spec +++ b/python-pytest-shutil.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-shutil # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,11 +23,11 @@ Version: 1.7.0 Release: 0 Summary: A goodie-bag of unix shell and environment tools for pytest License: MIT -Group: Development/Languages/Python URL: https://github.com/manahl/pytest-plugins Source: https://files.pythonhosted.org/packages/source/p/pytest-shutil/pytest-shutil-%{version}.tar.gz +# PATCH-FIX-UPSTREAM Adapted from gh#man-group/pytest-plugins#66bf6670f3ce10106d57a77ff634a8e5c9c3a39a +Patch0: remove-mock.patch BuildRequires: %{python_module execnet} -BuildRequires: %{python_module mock} BuildRequires: %{python_module path.py} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools-git} @@ -40,7 +40,6 @@ BuildRequires: python-contextlib2 %endif BuildRequires: python-rpm-macros Requires: python-execnet -Requires: python-mock Requires: python-path.py Requires: python-pytest Requires: python-six @@ -57,9 +56,10 @@ This library is a goodie-bag of Unix shell and environment management tools for automated tests. %prep -%setup -q -n pytest-shutil-%{version} +%autosetup -p1 -n pytest-shutil-%{version} sed -i '/contextlib2/d' setup.py sed -i '/path.\py/d' setup.py +sed -i '/mock/d' setup.py %build %python_build diff --git a/remove-mock.patch b/remove-mock.patch new file mode 100644 index 0000000..a054451 --- /dev/null +++ b/remove-mock.patch @@ -0,0 +1,53 @@ +Index: pytest-shutil-1.7.0/pytest_shutil/run.py +=================================================================== +--- pytest-shutil-1.7.0.orig/pytest_shutil/run.py ++++ pytest-shutil-1.7.0/pytest_shutil/run.py +@@ -11,7 +11,12 @@ import textwrap + from contextlib import closing + import subprocess + +-from mock import patch ++try: ++ from unittest.mock import patch ++except ImportError: ++ # python 2 ++ from mock import patch ++ + import execnet + from six.moves import cPickle # @UnresolvedImport + +Index: pytest-shutil-1.7.0/tests/integration/test_run_integration.py +=================================================================== +--- pytest-shutil-1.7.0.orig/tests/integration/test_run_integration.py ++++ pytest-shutil-1.7.0/tests/integration/test_run_integration.py +@@ -8,7 +8,10 @@ import inspect + import textwrap + from uuid import uuid4 + +-import mock ++try: ++ from unittest import mock ++except ImportError: ++ import mock + + from pytest_shutil import run, workspace + from pytest_shutil.env import no_cov +Index: pytest-shutil-1.7.0/tests/unit/test_run.py +=================================================================== +--- pytest-shutil-1.7.0.orig/tests/unit/test_run.py ++++ pytest-shutil-1.7.0/tests/unit/test_run.py +@@ -3,7 +3,13 @@ from uuid import uuid4 + from subprocess import PIPE, STDOUT + + import pytest +-from mock import Mock, patch, sentinel, DEFAULT, call ++ ++try: ++ from unittest.mock import Mock, patch, sentinel, DEFAULT, call ++except ImportError: ++ # python 2 ++ from mock import Mock, patch, sentinel, DEFAULT, call ++ + from six.moves import cPickle + + from pytest_shutil import run