From a1eafdecf673a83dc32e171c49bcf2e105e0a612 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Tue, 5 Nov 2019 21:05:08 +0530 Subject: [PATCH] Skip all failing tests when using venv Our isolation logic for venv isn't correct and that is causing these tests to fail. The culprits for this are: tests/lib/venv.py::VirtualEnvironment.user_site_packages tests/lib/venv.py::VirtualEnvironment.sitecustomize Both these together are supposed to create an environment to isolate the tests. However, they were written for virtualenv and make assumptions that are not true for environments created with venv. Until we can fix VirtualEnvironment to properly isolate the test from the underlying test environment when using venv, these tests will continue to fail. This is blocking an important bugfix for users facing issues with since pip is installing packages into `--user` when run in a venv, even when `--user` isn't visible from that environment. As a temporary band-aid for this problem, I'm skipping these tests to unblock us from shipping the bugfix for the aforementioned issue. The test isolation logic should be fixed to work for venv. Once such a fix is made, this commit should be reverted. --- tests/functional/test_freeze.py | 2 ++ tests/functional/test_install.py | 1 + tests/functional/test_install_reqs.py | 1 + tests/functional/test_install_user.py | 9 ++++++++- tests/functional/test_install_wheel.py | 1 + tests/functional/test_list.py | 3 +++ tests/functional/test_uninstall_user.py | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_freeze.py b/tests/functional/test_freeze.py index a4ff73d5c61..d13c931d0ef 100644 --- a/tests/functional/test_freeze.py +++ b/tests/functional/test_freeze.py @@ -703,6 +703,7 @@ def test_freeze_with_requirement_option_package_repeated_multi_file(script): @pytest.mark.network +@pytest.mark.incompatible_with_test_venv def test_freeze_user(script, virtualenv, data): """ Testing freeze with --user, first we have to install some stuff. @@ -733,6 +734,7 @@ def test_freeze_path(tmpdir, script, data): _check_output(result.stdout, expected) +@pytest.mark.incompatible_with_test_venv def test_freeze_path_exclude_user(tmpdir, script, data): """ Test freeze with --path and make sure packages from --user are not picked diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 3194b165384..844ea046dc5 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -124,6 +124,7 @@ def test_pep518_allows_missing_requires(script, data, common_wheels): assert result.files_created +@pytest.mark.incompatible_with_test_venv def test_pep518_with_user_pip(script, pip_src, data, common_wheels): """ Check that build dependencies are installed into the build diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index a653e0b2fb2..2022e1fee53 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -227,6 +227,7 @@ def test_install_local_with_subdirectory(script): result.assert_installed('version_subpkg.py', editable=False) +@pytest.mark.incompatible_with_test_venv def test_wheel_user_with_prefix_in_pydistutils_cfg( script, data, with_wheel): if os.name == 'posix': diff --git a/tests/functional/test_install_user.py b/tests/functional/test_install_user.py index 1ac644609e9..03725fc3229 100644 --- a/tests/functional/test_install_user.py +++ b/tests/functional/test_install_user.py @@ -27,6 +27,7 @@ def dist_in_site_packages(dist): class Tests_UserSite: @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_reset_env_system_site_packages_usersite(self, script): """ Check user site works as expected. @@ -42,6 +43,7 @@ def test_reset_env_system_site_packages_usersite(self, script): @pytest.mark.network @need_svn + @pytest.mark.incompatible_with_test_venv def test_install_subversion_usersite_editable_with_distribute( self, script, tmpdir): """ @@ -55,6 +57,7 @@ def test_install_subversion_usersite_editable_with_distribute( ) result.assert_installed('INITools', use_user_site=True) + @pytest.mark.incompatible_with_test_venv def test_install_from_current_directory_into_usersite( self, script, data, with_wheel): """ @@ -75,7 +78,6 @@ def test_install_from_current_directory_into_usersite( ) assert dist_info_folder in result.files_created - @pytest.mark.incompatible_with_test_venv def test_install_user_venv_nositepkgs_fails(self, virtualenv, script, data): """ @@ -96,6 +98,7 @@ def test_install_user_venv_nositepkgs_fails(self, virtualenv, ) @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_install_user_conflict_in_usersite(self, script): """ Test user install with conflict in usersite updates usersite. @@ -119,6 +122,7 @@ def test_install_user_conflict_in_usersite(self, script): assert not isfile(initools_v3_file), initools_v3_file @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_install_user_conflict_in_globalsite(self, virtualenv, script): """ Test user install with conflict in global site ignores site and @@ -149,6 +153,7 @@ def test_install_user_conflict_in_globalsite(self, virtualenv, script): assert isdir(initools_folder) @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_upgrade_user_conflict_in_globalsite(self, virtualenv, script): """ Test user install/upgrade with conflict in global site ignores site and @@ -178,6 +183,7 @@ def test_upgrade_user_conflict_in_globalsite(self, virtualenv, script): assert isdir(initools_folder) @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_install_user_conflict_in_globalsite_and_usersite( self, virtualenv, script): """ @@ -214,6 +220,7 @@ def test_install_user_conflict_in_globalsite_and_usersite( assert isdir(initools_folder) @pytest.mark.network + @pytest.mark.incompatible_with_test_venv def test_install_user_in_global_virtualenv_with_conflict_fails( self, script): """ diff --git a/tests/functional/test_install_wheel.py b/tests/functional/test_install_wheel.py index 2dfec01eedb..e218d6e7f17 100644 --- a/tests/functional/test_install_wheel.py +++ b/tests/functional/test_install_wheel.py @@ -233,6 +233,7 @@ def test_wheel_record_lines_in_deterministic_order(script, data): assert record_lines == sorted(record_lines) +@pytest.mark.incompatible_with_test_venv def test_install_user_wheel(script, data, with_wheel): """ Test user install from wheel (that has a script) diff --git a/tests/functional/test_list.py b/tests/functional/test_list.py index a863c42c91a..53f4152c2b7 100644 --- a/tests/functional/test_list.py +++ b/tests/functional/test_list.py @@ -94,6 +94,7 @@ def test_local_columns_flag(simple_script): @pytest.mark.network +@pytest.mark.incompatible_with_test_venv def test_user_flag(script, data): """ Test the behavior of --user flag in the list command @@ -110,6 +111,7 @@ def test_user_flag(script, data): @pytest.mark.network +@pytest.mark.incompatible_with_test_venv def test_user_columns_flag(script, data): """ Test the behavior of --user --format=columns flags in the list command @@ -502,6 +504,7 @@ def test_list_path(tmpdir, script, data): assert {'name': 'simple', 'version': '2.0'} in json_result +@pytest.mark.incompatible_with_test_venv def test_list_path_exclude_user(tmpdir, script, data): """ Test list with --path and make sure packages from --user are not picked diff --git a/tests/functional/test_uninstall_user.py b/tests/functional/test_uninstall_user.py index f99f3f21c7d..58079a293a8 100644 --- a/tests/functional/test_uninstall_user.py +++ b/tests/functional/test_uninstall_user.py @@ -9,6 +9,7 @@ from tests.lib import assert_all_changes, pyversion +@pytest.mark.incompatible_with_test_venv class Tests_UninstallUserSite: @pytest.mark.network