Open ritiek opened 4 years ago
Is your Tox installed with virtualenv>=20? There are a few tests (especially those marked with incompatible_with_test_venv
that can have this problem.
No, I didn't install tox or pytest under virtualenv and above failures are not in a virtualenv either. I installed these packages for my current user with:
$ pip3 install tox pytest --user
I am able to reproduce the above test failures even if I uninstall virtualenv (both user and system-wide packages).
If I run the tests by passing --use-venv
as pytest args (with even installing virtualenv), that is:
$ tox -e py36 -- tests/functional/test_install_user.py --use-venv
then the above failing tests are skipped (probably due to them being marked with incompatible_with_test_venv
).
Tox has a dependency on virtualenv; I meant to ask whether you’re using virtualenv>=20
to satisfy that dependency, not whether you installed tox inside a virtual environment. Sorry if my wording was causing misunderstandings.
You can find out the version of virtualenv tox is depending on with pip3 list
. Try pip3 install "virtualenv<20"
and run tox again to see whether this fixes the problem.
I see but it's still weird. Those tests still fail with virtualenv<20.
$ pip3 list | grep -e tox -e virtualenv
tox 3.14.5
virtualenv 16.7.10
I also had virtualenv v16.7.10 installed in the log as of my original post:
py36 installed: apipkg==1.5,atomicwrites==1.3.0,attrs==19.3.0,cffi==1.14.0,coverage==5.0.3,cryptography==2.8,csv23==0.1.6,execnet==1.7.1,freezegun==0.3.15,importlib-metadata==1.5.0,mock==4.0.1,more-itertools==8.2.0,pip==20.1.dev0,pluggy==0.13.1,pretend==1.0.9,py==1.8.1,pycparser==2.19,pytest==3.8.2,pytest-cov==2.8.1,pytest-forked==1.1.3,pytest-rerunfailures==6.0,pytest-timeout==1.3.4,pytest-xdist==1.27.0,python-dateutil==2.8.1,PyYAML==5.3,scripttest==1.3,setuptools==40.8.0,six==1.14.0,virtualenv==16.7.10,Werkzeug==0.16.0,wheel==0.33.1,zipp==3.0.0
I also tried deleting .tox
cache directory (which gets generated upon running tests), checking virtualenv version and re-running tox but still no luck.
I'll see if I can figure this out tonight.
Could you share the output of tox -e py36 --notest
?
Yep, sure. Here you go:
$ tox -e py36 --notest master
GLOB sdist-make: /home/ritiek/Downloads/pip/setup.py
py36 inst-nodeps: /home/ritiek/Downloads/pip/.tox/.tmp/package/1/pip-20.1.dev0.zip
py36 installed: apipkg==1.5,atomicwrites==1.3.0,attrs==19.3.0,cffi==1.14.0,coverage==5.0.3,cryptography==2.8,csv23==0.1.6,execnet==1.7.1,freezegun==0.3.15,importlib-metadata==1.5.0,mock==4.0.1,more-itertools==8.2.0,pip==20.1.dev0,pluggy==0.13.1,pretend==1.0.9,py==1.8.1,pycparser==2.19,pytest==3.8.2,pytest-cov==2.8.1,pytest-forked==1.1.3,pytest-rerunfailures==6.0,pytest-timeout==1.3.4,pytest-xdist==1.27.0,python-dateutil==2.8.1,PyYAML==5.3,scripttest==1.3,setuptools==42.0.2,six==1.14.0,virtualenv==16.7.10,Werkzeug==0.16.0,wheel==0.33.6,zipp==3.0.0
___________________________________________________________________________________________________________________ summary ___________________________________________________________________________________________________________________
py36: skipped tests
congratulations :)
The tests seem to failing cuz of this error (see log):
-- stderr: -------------------- ERROR: Will not install to the user site because it will lack sys.path precedence to INITools in /tmp/pytest-of-ritiek/pytest-27/test_install_user_conflict_in_0/workspace/venv/lib/python3.6/site-packages
This error can also reproduced using virtualenv, like so:
$ virtualenv --version
16.7.10
$ virtualenv env --system-site-packages
$ pip install requests==2.20.0
$ pip install requests==2.20.1 --user
ERROR: Will not install to the user site because it will lack sys.path precedence to requests in /home/ritiek/Downloads/pip/env/lib/python3.6/site-packages
Is this error expected here?
Because I think a similar thing happens (in line 132 and 134) in the failing test: https://github.com/pypa/pip/blob/5b442d503a6c1bd0d7349c50aa2d72f17340a016/tests/functional/test_install_user.py#L123-L152
I'm kinda confused here. Since this test is marked with @pytest.mark.incompatible_with_test_venv
which makes it so it is skipped when --use-venv
is passed to pytest args. But even when this arg isn't passed to pytest, the function definition still accepts pytest's virtualenv
parameter (which then probably causes the error as reproduced above).
However, if this is really the case (that this test runs in virtualenv even when --use-venv
isn't passed) then I'm not sure why these tests pass on CI either..
For what it's worth I see the same thing in 6 tests:
FAILED tests/functional/test_install_user.py::Tests_UserSite::test_install_user_conflict_in_globalsite
FAILED tests/functional/test_install_user.py::Tests_UserSite::test_install_user_conflict_in_globalsite_and_usersite
FAILED tests/functional/test_new_resolver_user.py::test_new_resolver_install_user_reinstall_global_site
FAILED tests/functional/test_new_resolver_user.py::test_new_resolver_install_user_conflict_in_global_site
FAILED tests/functional/test_new_resolver_user.py::test_new_resolver_install_user_conflict_in_global_and_user_sites
FAILED tests/functional/test_uninstall_user.py::Tests_UninstallUserSite::test_uninstall_from_usersite_with_dist_in_global_site
This is on debian unstable, python 3.8, virtualenv 16.7.10, pip git master.
It seems like the virtualenv.sitecustomize trick in _patch_dist_in_site_packages()
is not doing what it's supposed to do: the sitecustomize.py file appears where it should but ... it's like it's never imported?
Ah. Our test's patching seems to be not working. :(
Environment
pip 20.1.dev0
(35181cdf01e1432e9949a95d526597b80ac510c9)Python 3.6.9
Linux Mint 19.3
Description
Locally executing tests in
tests/functional/test_install_user.py
returns failures.Expected behavior
All tests should pass.
How to Reproduce
$ tox -e py36 -- tests/functional/test_install_user.py
.(the same tests also fail when executing the complete test suite)
Output
$ tox -e py36 -- -v tests/functional/test_install_user.py
```bash $ tox -e py36 -- -v tests/functional/test_install_user.py master GLOB sdist-make: /home/ritiek/Downloads/pip/setup.py py36 inst-nodeps: /home/ritiek/Downloads/pip/.tox/.tmp/package/1/pip-20.1.dev0.zip py36 installed: apipkg==1.5,atomicwrites==1.3.0,attrs==19.3.0,cffi==1.14.0,coverage==5.0.3,cryptography==2.8,csv23==0.1.6,execnet==1.7.1,freezegun==0.3.15,importlib-metadata==1.5.0,mock==4.0.1,more-itertools==8.2.0,pip==20.1.dev0,pluggy==0.13.1,pretend==1.0.9,py==1.8.1,pycparser==2.19,pytest==3.8.2,pytest-cov==2.8.1,pytest-forked==1.1.3,pytest-rerunfailures==6.0,pytest-timeout==1.3.4,pytest-xdist==1.27.0,python-dateutil==2.8.1,PyYAML==5.3,scripttest==1.3,setuptools==40.8.0,six==1.14.0,virtualenv==16.7.10,Werkzeug==0.16.0,wheel==0.33.1,zipp==3.0.0 py36 run-test-pre: PYTHONHASHSEED='977510171' py36 run-test-pre: commands[0] | python -c 'import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)' /home/ritiek/Downloads/pip/tests/data/common_wheels py36 run-test-pre: commands[1] | python /home/ritiek/Downloads/pip/tools/tox_pip.py wheel -w /home/ritiek/Downloads/pip/tests/data/common_wheels -r /home/ritiek/Downloads/pip/tools/requirements/tests-common_wheels.txt Collecting setuptools>=40.8.0 File was already downloaded /home/ritiek/Downloads/pip/tests/data/common_wheels/setuptools-45.2.0-py3-none-any.whl Collecting wheel File was already downloaded /home/ritiek/Downloads/pip/tests/data/common_wheels/wheel-0.34.2-py2.py3-none-any.whl Skipping setuptools, due to already being wheel. Skipping wheel, due to already being wheel. py36 run-test: commands[0] | pytest --timeout 300 -v tests/functional/test_install_user.py ============================================================================================================= test session starts ============================================================================================================= platform linux -- Python 3.6.9, pytest-3.8.2, py-1.8.1, pluggy-0.13.1 -- /home/ritiek/Downloads/pip/.tox/py36/bin/python cachedir: .pytest_cache rootdir: /home/ritiek/Downloads/pip, inifile: setup.cfg plugins: rerunfailures-6.0, timeout-1.3.4, xdist-1.27.0, cov-2.8.1, forked-1.1.3 timeout: 300.0s timeout method: signal timeout func_only: False collected 9 items tests/functional/test_install_user.py::Tests_UserSite::test_reset_env_system_site_packages_usersite PASSED [ 11%] tests/functional/test_install_user.py::Tests_UserSite::test_install_subversion_usersite_editable_with_distribute SKIPPED [ 22%] tests/functional/test_install_user.py::Tests_UserSite::test_install_from_current_directory_into_usersite PASSED [ 33%] tests/functional/test_install_user.py::Tests_UserSite::test_install_user_venv_nositepkgs_fails PASSED [ 44%] tests/functional/test_install_user.py::Tests_UserSite::test_install_user_conflict_in_usersite PASSED [ 55%] tests/functional/test_install_user.py::Tests_UserSite::test_install_user_conflict_in_globalsite FAILED [ 66%] tests/functional/test_install_user.py::Tests_UserSite::test_upgrade_user_conflict_in_globalsite PASSED [ 77%] tests/functional/test_install_user.py::Tests_UserSite::test_install_user_conflict_in_globalsite_and_usersite FAILED [ 88%] tests/functional/test_install_user.py::Tests_UserSite::test_install_user_in_global_virtualenv_with_conflict_fails PASSED [100%] ================================================================================================================== FAILURES =================================================================================================================== ___________________________________________________________________________________________ Tests_UserSite.test_install_user_conflict_in_globalsite ___________________________________________________________________________________________ self =I thought it's because I didn't execute the test as root (guessing from the failing test name
test_install_user_conflict_in_globalsite
) but executing as root causes the same failures.