# HG changeset patch # User Gregory Szorc # Date 1572928418 28800 # Node ID 9bab6407c2c9d8b4793e58e7f20c3771c61ec66c # Parent 9a250055ffbc95887f3f7e9a7bc5552d2ca803ca tests: use venv on Python 3 This test was failing in some Python 3 environments because `$PYTHON -m virtualenv` was somehow resulting in Python 2 being used. Why, I'm not sure. Python 3 includes virtualenv in the standard library as the `venv` module. This commit changes test-install.t to use `$PYTHON -m venv` on Python 3 and `$PYTHON -m virtualenv` on Python 2 (if available). I chose to make some test output duplicated because we can't have nested conditionals and there is no easy way to express ORing of hghave checks. Differential Revision: https://phab.mercurial-scm.org/D7224 diff -r 9a250055ffbc -r 9bab6407c2c9 tests/test-install.t --- a/tests/test-install.t Mon Nov 04 20:10:51 2019 -0800 +++ b/tests/test-install.t Mon Nov 04 20:33:38 2019 -0800 @@ -236,20 +236,53 @@ #endif -#if virtualenv - Verify that Mercurial is installable with pip. Note that this MUST be the last test in this file, because we do some nasty things to the shell environment in order to make the virtualenv work reliably. +On Python 3, we use the venv module, which is part of the standard library. +On Python 2, we use the 3rd party virtualenv module, if available. + $ cd $TESTTMP + $ unset PYTHONPATH + +#if py3 + $ "$PYTHON" -m venv installenv >> pip.log + +Note: we use this weird path to run pip and hg to avoid platform differences, +since it's bin on most platforms but Scripts on Windows. + $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log + $ ./installenv/*/hg debuginstall || cat pip.log + checking encoding (ascii)... + checking Python executable (*) (glob) + checking Python version (3.*) (glob) + checking Python lib (*)... (glob) + checking Python security support (*) (glob) + checking Mercurial version (*) (glob) + checking Mercurial custom build (*) (glob) + checking module policy (*) (glob) + checking installed modules (*/mercurial)... (glob) + checking registered compression engines (*) (glob) + checking available compression engines (*) (glob) + checking available compression engines for wire protocol (*) (glob) + checking "re2" regexp engine \((available|missing)\) (re) + checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) + checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) + checking commit editor... (*) (glob) + checking username (test) + no problems detected +#endif + +#if no-py3 virtualenv + Note: --no-site-packages is deprecated, but some places have an ancient virtualenv from their linux distro or similar and it's not yet the default for them. - $ unset PYTHONPATH + $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) + Note: we use this weird path to run pip and hg to avoid platform differences, since it's bin on most platforms but Scripts on Windows. $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log @@ -258,8 +291,7 @@ $ ./installenv/*/hg debuginstall || cat pip.log checking encoding (ascii)... checking Python executable (*) (glob) - checking Python version (2.*) (glob) (no-py3 !) - checking Python version (3.*) (glob) (py3 !) + checking Python version (2.*) (glob) checking Python lib (*)... (glob) checking Python security support (*) (glob) TLS 1.2 not supported by Python install; network connections lack modern security (?)