diff --git a/python-pytest-virtualenv.changes b/python-pytest-virtualenv.changes index be5a37f..864e64b 100644 --- a/python-pytest-virtualenv.changes +++ b/python-pytest-virtualenv.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Dec 11 22:44:02 UTC 2020 - Matej Cepl + +- Add remove_mock.patch to remove dependency on the external mock + package (gh#man-group/pytest-plugins#168). Also add + remove_virtualenv.patch to remove dependency on external + virtualenv package. + ------------------------------------------------------------------- Mon Jun 3 08:53:22 UTC 2019 - Tomáš Chvátal diff --git a/python-pytest-virtualenv.spec b/python-pytest-virtualenv.spec index 8226442..acfcdc3 100644 --- a/python-pytest-virtualenv.spec +++ b/python-pytest-virtualenv.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-virtualenv # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,21 +25,25 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/manahl/pytest-plugins Source: https://files.pythonhosted.org/packages/source/p/pytest-virtualenv/pytest-virtualenv-%{version}.tar.gz -BuildRequires: %{python_module mock} +# PATCH-FIX-UPSTREAM remove_mock.patch gh#man-group/pytest-plugins#168 mcepl@suse.com +# remove dependency on the external module mock +Patch0: remove_mock.patch +# PATCH-FIX-UPSTREAM remove_mock.patch gh#man-group/pytest-plugins#168 mcepl@suse.com +# and while at it, we can remove dependency on the external module +# virtualenv as well +Patch1: remove_virtualenv.patch BuildRequires: %{python_module path.py} BuildRequires: %{python_module pytest-fixture-config} BuildRequires: %{python_module pytest-shutil} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools-git} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module virtualenv} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-path.py Requires: python-pytest-fixture-config Requires: python-pytest-shutil Requires: python-setuptools -Requires: python-virtualenv BuildArch: noarch %python_subpackages @@ -49,7 +53,7 @@ teardown. The fixture has utility methods to install packages and list what's installed. %prep -%setup -q -n pytest-virtualenv-%{version} +%autosetup -p1 -n pytest-virtualenv-%{version} %build %python_build diff --git a/remove_mock.patch b/remove_mock.patch new file mode 100644 index 0000000..95812c3 --- /dev/null +++ b/remove_mock.patch @@ -0,0 +1,26 @@ +--- a/tests/unit/test_venv.py ++++ b/tests/unit/test_venv.py +@@ -1,4 +1,4 @@ +-import mock ++from unittest.mock import patch + + import pytest_virtualenv as venv + from pytest_shutil import env +@@ -6,7 +6,7 @@ from pytest_shutil import env + + def test_PYTHONPATH_not_present_in_testing_env_if_set(): + with env.set_env('PYTHONPATH', 'fred'): +- with mock.patch.object(venv.Workspace, 'run') as run: ++ with patch.object(venv.Workspace, 'run') as run: + venv.VirtualEnv() + call = run.mock_calls[0] + assert 'PYTHONPATH' not in call[2]['env'] +@@ -18,7 +18,7 @@ def test_PYTHONPATH_not_present_in_testi + + def test_PYTHONPATH_not_present_in_testing_env_if_unset(): + with env.no_env('PYTHONPATH'): +- with mock.patch.object(venv.Workspace, 'run') as run: ++ with patch.object(venv.Workspace, 'run') as run: + venv.VirtualEnv() + call = run.mock_calls[0] + assert 'PYTHONPATH' not in call[2]['env'] diff --git a/remove_virtualenv.patch b/remove_virtualenv.patch new file mode 100644 index 0000000..36d163f --- /dev/null +++ b/remove_virtualenv.patch @@ -0,0 +1,23 @@ +--- + pytest_virtualenv.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/pytest_virtualenv.py ++++ b/pytest_virtualenv.py +@@ -21,7 +21,7 @@ class FixtureConfig(Config): + + # Default values for system resource locations - patch this to change defaults + # Can be a string or list of them +-DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = [sys.executable, '-m', 'virtualenv'] ++DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = [sys.executable, '-m', 'venv'] + + CONFIG = FixtureConfig( + virtualenv_executable=os.getenv('VIRTUALENV_FIXTURE_EXECUTABLE', DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE), +@@ -137,7 +137,6 @@ class VirtualEnv(Workspace): + cmd = [self.virtualenv_cmd] + else: + cmd = list(self.virtualenv_cmd) +- cmd.extend(['-p', python or cmdline.get_real_python_executable()]) + cmd.extend(self.args) + cmd.append(str(self.virtualenv)) + self.run(cmd)