Hello community, here is the log from the commit of package python-pytest-virtualenv for openSUSE:Factory checked in at 2020-12-16 10:59:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-virtualenv (Old) and /work/SRC/openSUSE:Factory/.python-pytest-virtualenv.new.2328 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-virtualenv" Wed Dec 16 10:59:30 2020 rev:3 rq:855630 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-virtualenv/python-pytest-virtualenv.changes 2019-06-18 14:45:19.037734968 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-virtualenv.new.2328/python-pytest-virtualenv.changes 2020-12-16 10:59:32.163513816 +0100 @@ -1,0 +2,13 @@ +Sun Dec 13 21:55:46 UTC 2020 - Matej Cepl <mc...@suse.com> + +- We don't need to break Python 2.7 + +------------------------------------------------------------------- +Fri Dec 11 22:44:02 UTC 2020 - Matej Cepl <mc...@suse.com> + +- 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. + +------------------------------------------------------------------- New: ---- remove_mock.patch remove_virtualenv.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-virtualenv.spec ++++++ --- /var/tmp/diff_new_pack.dRPbaf/_old 2020-12-16 10:59:33.735515361 +0100 +++ /var/tmp/diff_new_pack.dRPbaf/_new 2020-12-16 10:59:33.739515364 +0100 @@ -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,29 @@ 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 mc...@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 mc...@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} +%if 0%{?suse_version} <= 1500 +BuildRequires: %{python_module mock} BuildRequires: %{python_module virtualenv} +%endif 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 +57,7 @@ what's installed. %prep -%setup -q -n pytest-virtualenv-%{version} +%autosetup -p1 -n pytest-virtualenv-%{version} %build %python_build @@ -59,7 +67,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%pytest +# Requires network access +%pytest -k 'not test_installed_packages' %files %{python_files} %doc CHANGES.md README.md ++++++ remove_mock.patch ++++++ --- a/tests/unit/test_venv.py +++ b/tests/unit/test_venv.py @@ -1,4 +1,7 @@ -import mock +try: + from unittest.mock import patch +except ImportError: + from mock import patch import pytest_virtualenv as venv from pytest_shutil import env @@ -6,7 +9,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 +21,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'] ++++++ remove_virtualenv.patch ++++++ --- pytest_virtualenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/pytest_virtualenv.py +++ b/pytest_virtualenv.py @@ -15,13 +15,19 @@ from pytest_shutil.workspace import Work from pytest_shutil import run, cmdline from pytest_fixture_config import Config, yield_requires_config +PY2 = sys.version_info[0] == 2 + class FixtureConfig(Config): __slots__ = ('virtualenv_executable') + # 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'] +if PY2: + DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = [sys.executable, '-m', 'virtualenv'] +else: + DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE = [sys.executable, '-m', 'venv'] CONFIG = FixtureConfig( virtualenv_executable=os.getenv('VIRTUALENV_FIXTURE_EXECUTABLE', DEFAULT_VIRTUALENV_FIXTURE_EXECUTABLE), @@ -78,7 +84,7 @@ class PackageEntry(object): def match(self, package_type): if package_type is self.ANY: - return True + return True elif package_type is self.REL: if self.isrel: return True @@ -137,7 +143,8 @@ class VirtualEnv(Workspace): cmd = [self.virtualenv_cmd] else: cmd = list(self.virtualenv_cmd) - cmd.extend(['-p', python or cmdline.get_real_python_executable()]) + if PY2: + cmd.extend(['-p', python or cmdline.get_real_python_executable()]) cmd.extend(self.args) cmd.append(str(self.virtualenv)) self.run(cmd) --- a/tests/integration/test_tmpvirtualenv.py +++ b/tests/integration/test_tmpvirtualenv.py @@ -5,6 +5,8 @@ import textwrap import pytest_virtualenv as venv +PY2 = sys.version_info[0] == 2 + def check_member(name, ips): return name in ips @@ -15,4 +17,5 @@ def test_installed_packages(): ips = v.installed_packages() assert len(ips) > 0 check_member('pip', ips) - check_member('virtualenv', ips) \ No newline at end of file + if PY2: + check_member('virtualenv', ips) _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org