From 4f1b88375a0d84b535fe743847822ebcbe8e22d6 Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Mon, 14 Oct 2019 12:56:10 +0530 Subject: [PATCH 1/3] Skip running svn tests when svn isn't installed Signed-off-by: Harsh Vardhan --- tests/lib/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index 276c6e85a70..32580739f36 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -1037,6 +1037,12 @@ def need_bzr(fn): )(fn)) +def need_svn(fn): + return pytest.mark.svn(need_executable( + 'Subversion', ('svn', '--version') + )(fn)) + + def need_mercurial(fn): return pytest.mark.mercurial(need_executable( 'Mercurial', ('hg', 'version') From 2f1a419393b40d520c1f2147dd94f3c34596e129 Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Mon, 14 Oct 2019 13:11:30 +0530 Subject: [PATCH 2/3] Add news file for the change Signed-off-by: Harsh Vardhan --- news/7193.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/7193.bugfix diff --git a/news/7193.bugfix b/news/7193.bugfix new file mode 100644 index 00000000000..a871b63031d --- /dev/null +++ b/news/7193.bugfix @@ -0,0 +1 @@ +Skip running tests which require subversion, when svn isn't installed From 0e6ac42c93383ab5f604ffae39d30df5406a403c Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Mon, 14 Oct 2019 15:27:57 +0530 Subject: [PATCH 3/3] Add need_svn decorator for tests which require svn Signed-off-by: Harsh Vardhan --- tests/functional/test_freeze.py | 3 ++- tests/functional/test_install.py | 3 ++- tests/functional/test_install_reqs.py | 3 ++- tests/functional/test_install_user.py | 4 ++-- tests/functional/test_uninstall.py | 9 +++++++-- tests/unit/test_vcs.py | 4 ++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/functional/test_freeze.py b/tests/functional/test_freeze.py index 546a4828d5c..5a10b93b7b5 100644 --- a/tests/functional/test_freeze.py +++ b/tests/functional/test_freeze.py @@ -12,6 +12,7 @@ _git_commit, need_bzr, need_mercurial, + need_svn, path_to_url, ) @@ -169,7 +170,7 @@ def test_freeze_editable_git_with_no_remote(script, tmpdir, deprecated_python): _check_output(result.stdout, expected) -@pytest.mark.svn +@need_svn def test_freeze_svn(script, tmpdir): """Test freezing a svn checkout""" diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index f07dcd4eff0..f8f814a092d 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -21,6 +21,7 @@ create_test_package_with_setup, need_bzr, need_mercurial, + need_svn, path_to_url, pyversion, pyversion_tuple, @@ -251,7 +252,7 @@ def test_basic_editable_install(script): assert not result.files_updated -@pytest.mark.svn +@need_svn def test_basic_install_editable_from_svn(script): """ Test checking out from svn. diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index faa971eadb3..a653e0b2fb2 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -5,6 +5,7 @@ from tests.lib import ( _create_test_package_with_subdirectory, + need_svn, path_to_url, pyversion, requirements_file, @@ -100,7 +101,7 @@ def test_relative_requirements_file(script, data): @pytest.mark.network -@pytest.mark.svn +@need_svn def test_multiple_requirements_files(script, tmpdir): """ Test installing from multiple nested requirements files. diff --git a/tests/functional/test_install_user.py b/tests/functional/test_install_user.py index 537f402769b..1ac644609e9 100644 --- a/tests/functional/test_install_user.py +++ b/tests/functional/test_install_user.py @@ -6,7 +6,7 @@ import pytest -from tests.lib import pyversion +from tests.lib import need_svn, pyversion from tests.lib.local_repos import local_checkout @@ -41,7 +41,7 @@ def test_reset_env_system_site_packages_usersite(self, script): assert 'INITools' == project_name, project_name @pytest.mark.network - @pytest.mark.svn + @need_svn def test_install_subversion_usersite_editable_with_distribute( self, script, tmpdir): """ diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 13d18768edc..84436aca098 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -13,7 +13,11 @@ from pip._internal.req.constructors import install_req_from_line from pip._internal.utils.misc import rmtree -from tests.lib import assert_all_changes, create_test_package_with_setup +from tests.lib import ( + assert_all_changes, + create_test_package_with_setup, + need_svn, +) from tests.lib.local_repos import local_checkout, local_repo @@ -289,6 +293,7 @@ def test_uninstall_easy_installed_console_scripts(script): @pytest.mark.network +@need_svn def test_uninstall_editable_from_svn(script, tmpdir): """ Test uninstalling an editable installation from svn. @@ -352,7 +357,7 @@ def _test_uninstall_editable_with_source_outside_venv( @pytest.mark.network -@pytest.mark.svn +@need_svn def test_uninstall_from_reqs_file(script, tmpdir): """ Test uninstall from a requirements file. diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index d4110fd61ac..42fc43d6855 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -13,7 +13,7 @@ from pip._internal.vcs.mercurial import Mercurial from pip._internal.vcs.subversion import Subversion from pip._internal.vcs.versioncontrol import RevOptions, VersionControl -from tests.lib import is_svn_installed, pyversion +from tests.lib import is_svn_installed, need_svn, pyversion if pyversion >= '3': VERBOSE_FALSE = False @@ -411,7 +411,7 @@ def test_subversion__init_use_interactive( assert svn.use_interactive == expected -@pytest.mark.svn +@need_svn def test_subversion__call_vcs_version(): """ Test Subversion.call_vcs_version() against local ``svn``.