From patchwork Tue Nov 5 04:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7224: tests: use venv on Python 3 From: phabricator X-Patchwork-Id: 42737 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 5 Nov 2019 04:34:36 +0000 indygreg created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D7224 AFFECTED FILES tests/test-install.t CHANGE DETAILS To: indygreg, #hg-reviewers Cc: mjpieters, mercurial-devel diff --git a/tests/test-install.t b/tests/test-install.t --- a/tests/test-install.t +++ b/tests/test-install.t @@ -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 (?)