##// END OF EJS Templates
tests: use venv on Python 3...
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

File last commit:

r43728:9bab6407 stable
r43728:9bab6407 stable
Show More
test-install.t
312 lines | 13.5 KiB | text/troff | Tads3Lexer
Pradeepkumar Gayam
tests: unify test-install
r11917 hg debuginstall
$ hg debuginstall
Martin Geisler
debuginstall: lowercase status messages
r16934 checking encoding (ascii)...
Matt Mackall
debuginstall: change showing to checking for consistency and future checking
r20741 checking Python executable (*) (glob)
Matt Harbison
py3: conditionalize the python version in test-install.t
r41010 checking Python version (2.*) (glob) (no-py3 !)
checking Python version (3.*) (glob) (py3 !)
Matt Harbison
run-tests: alias hg to hg.exe on Windows...
r41011 checking Python lib (.*[Ll]ib.*)... (re)
Gregory Szorc
commands: print security protocol support in debuginstall...
r30222 checking Python security support (*) (glob)
TLS 1.2 not supported by Python install; network connections lack modern security (?)
SNI not supported by Python install; may have connectivity issues with some servers (?)
timeless
debuginstall: add mercurial version
r29197 checking Mercurial version (*) (glob)
checking Mercurial custom build (*) (glob)
timeless
debuginstall: expose modulepolicy...
r29266 checking module policy (*) (glob)
Martin Geisler
debuginstall: lowercase status messages
r16934 checking installed modules (*mercurial)... (glob)
Gregory Szorc
debuginstall: print compression engine support...
r30462 checking registered compression engines (*zlib*) (glob)
checking available compression engines (*zlib*) (glob)
Gregory Szorc
wireproto: advertise supported media types and compression formats...
r30762 checking available compression engines for wire protocol (*zlib*) (glob)
Boris Feld
debuginstall: add a line about re2 availability...
r35464 checking "re2" regexp engine \((available|missing)\) (re)
Martin Geisler
debuginstall: lowercase status messages
r16934 checking templates (*mercurial?templates)... (glob)
timeless
debuginstall: convert to formatter...
r28440 checking default template (*mercurial?templates?map-cmdline.default) (glob)
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 checking commit editor... (*) (glob)
timeless
debuginstall: convert to formatter...
r28440 checking username (test)
Martin Geisler
debuginstall: lowercase status messages
r16934 no problems detected
Pradeepkumar Gayam
tests: unify test-install
r11917
timeless
debuginstall: convert to formatter...
r28440 hg debuginstall JSON
Matt Harbison
test-install: fix output on Windows...
r28885 $ hg debuginstall -Tjson | sed 's|\\\\|\\|g'
timeless
debuginstall: convert to formatter...
r28440 [
{
Gregory Szorc
debuginstall: print compression engine support...
r30462 "compengines": ["bz2", "bz2truncated", "none", "zlib"*], (glob)
"compenginesavail": ["bz2", "bz2truncated", "none", "zlib"*], (glob)
Gregory Szorc
wireproto: advertise supported media types and compression formats...
r30762 "compenginesserver": [*"zlib"*], (glob)
timeless
debuginstall: convert to formatter...
r28440 "defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob)
"defaulttemplateerror": null,
"defaulttemplatenotfound": "default",
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 "editor": "*", (glob)
timeless
debuginstall: convert to formatter...
r28440 "editornotfound": false,
"encoding": "ascii",
"encodingerror": null,
Yuya Nishihara
debuginstall: check C extensions only if they are loadable per policy...
r32204 "extensionserror": null, (no-pure !)
timeless
debuginstall: expose modulepolicy...
r29266 "hgmodulepolicy": "*", (glob)
timeless
debuginstall: convert to formatter...
r28440 "hgmodules": "*mercurial", (glob)
timeless
debuginstall: add mercurial version
r29197 "hgver": "*", (glob)
"hgverextra": "*", (glob)
timeless
debuginstall: convert to formatter...
r28440 "problems": 0,
Danek Duvall
tests: python executable path should always be globbed...
r28544 "pythonexe": "*", (glob)
Sean Farley
tests: python executable should always be globbed...
r28626 "pythonlib": "*", (glob)
Gregory Szorc
commands: print security protocol support in debuginstall...
r30222 "pythonsecurity": [*], (glob)
timeless
debuginstall: convert to formatter...
r28440 "pythonver": "*.*.*", (glob)
Boris Feld
debuginstall: add a line about re2 availability...
r35464 "re2": (true|false), (re)
timeless
debuginstall: convert to formatter...
r28440 "templatedirs": "*mercurial?templates", (glob)
"username": "test",
"usernameerror": null,
"vinotfound": false
}
]
Pradeepkumar Gayam
tests: unify test-install
r11917 hg debuginstall with no username
$ HGUSER= hg debuginstall
Martin Geisler
debuginstall: lowercase status messages
r16934 checking encoding (ascii)...
Matt Mackall
debuginstall: change showing to checking for consistency and future checking
r20741 checking Python executable (*) (glob)
Matt Harbison
py3: conditionalize the python version in test-install.t
r41010 checking Python version (2.*) (glob) (no-py3 !)
checking Python version (3.*) (glob) (py3 !)
Matt Harbison
run-tests: alias hg to hg.exe on Windows...
r41011 checking Python lib (.*[Ll]ib.*)... (re)
Gregory Szorc
commands: print security protocol support in debuginstall...
r30222 checking Python security support (*) (glob)
TLS 1.2 not supported by Python install; network connections lack modern security (?)
SNI not supported by Python install; may have connectivity issues with some servers (?)
timeless
debuginstall: add mercurial version
r29197 checking Mercurial version (*) (glob)
checking Mercurial custom build (*) (glob)
timeless
debuginstall: expose modulepolicy...
r29266 checking module policy (*) (glob)
Martin Geisler
debuginstall: lowercase status messages
r16934 checking installed modules (*mercurial)... (glob)
Gregory Szorc
debuginstall: print compression engine support...
r30462 checking registered compression engines (*zlib*) (glob)
checking available compression engines (*zlib*) (glob)
Gregory Szorc
wireproto: advertise supported media types and compression formats...
r30762 checking available compression engines for wire protocol (*zlib*) (glob)
Boris Feld
debuginstall: add a line about re2 availability...
r35464 checking "re2" regexp engine \((available|missing)\) (re)
Martin Geisler
debuginstall: lowercase status messages
r16934 checking templates (*mercurial?templates)... (glob)
timeless
debuginstall: convert to formatter...
r28440 checking default template (*mercurial?templates?map-cmdline.default) (glob)
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 checking commit editor... (*) (glob)
Martin Geisler
debuginstall: lowercase status messages
r16934 checking username...
Matt Mackall
ui: suggest config --edit when no username is set
r20574 no username supplied
Martin Geisler
Merge with stable
r12084 (specify a username in your configuration file)
Pradeepkumar Gayam
tests: unify test-install
r11917 1 problems detected, please check your install!
Matt Mackall
tests: add exit codes to unified tests
r12316 [1]
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891
Yuya Nishihara
debuginstall: use codecs.lookup() to detect invalid encoding...
r34131 hg debuginstall with invalid encoding
$ HGENCODING=invalidenc hg debuginstall | grep encoding
checking encoding (invalidenc)...
unknown encoding: invalidenc
Yuya Nishihara
debuginstall: do not pass exception object to formatter (issue5676)
r34132 exception message in JSON
$ HGENCODING=invalidenc HGUSER= hg debuginstall -Tjson | grep error
"defaulttemplateerror": null,
"encodingerror": "unknown encoding: invalidenc",
"extensionserror": null, (no-pure !)
"usernameerror": "no username supplied",
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891 path variables are expanded (~ is the same as $TESTTMP)
$ mkdir tools
$ touch tools/testeditor.exe
#if execbit
$ chmod 755 tools/testeditor.exe
#endif
Kyle Lippincott
tests: switch test from '--config ui.editor=~/foo' to HGEDITOR=~/foo...
r35538 $ HGEDITOR="~/tools/testeditor.exe" hg debuginstall
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891 checking encoding (ascii)...
checking Python executable (*) (glob)
Matt Harbison
py3: conditionalize the python version in test-install.t
r41010 checking Python version (2.*) (glob) (no-py3 !)
checking Python version (3.*) (glob) (py3 !)
Matt Harbison
run-tests: alias hg to hg.exe on Windows...
r41011 checking Python lib (.*[Ll]ib.*)... (re)
Gregory Szorc
commands: print security protocol support in debuginstall...
r30222 checking Python security support (*) (glob)
TLS 1.2 not supported by Python install; network connections lack modern security (?)
SNI not supported by Python install; may have connectivity issues with some servers (?)
timeless
debuginstall: add mercurial version
r29197 checking Mercurial version (*) (glob)
checking Mercurial custom build (*) (glob)
timeless
debuginstall: expose modulepolicy...
r29266 checking module policy (*) (glob)
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891 checking installed modules (*mercurial)... (glob)
Gregory Szorc
debuginstall: print compression engine support...
r30462 checking registered compression engines (*zlib*) (glob)
checking available compression engines (*zlib*) (glob)
Gregory Szorc
wireproto: advertise supported media types and compression formats...
r30762 checking available compression engines for wire protocol (*zlib*) (glob)
Boris Feld
debuginstall: add a line about re2 availability...
r35464 checking "re2" regexp engine \((available|missing)\) (re)
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891 checking templates (*mercurial?templates)... (glob)
timeless
debuginstall: convert to formatter...
r28440 checking default template (*mercurial?templates?map-cmdline.default) (glob)
Kyle Lippincott
tests: switch test from '--config ui.editor=~/foo' to HGEDITOR=~/foo...
r35538 checking commit editor... ($TESTTMP/tools/testeditor.exe)
timeless
debuginstall: convert to formatter...
r28440 checking username (test)
Matt Harbison
debuginstall: expand the editor path before searching for it (issue4380)...
r24891 no problems detected
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 print out the binary post-shlexsplit in the error message when commit editor is
not found (this is intentionally using backslashes to mimic a windows usecase).
$ HGEDITOR="c:\foo\bar\baz.exe -y -z" hg debuginstall
checking encoding (ascii)...
checking Python executable (*) (glob)
Matt Harbison
py3: conditionalize the python version in test-install.t
r41010 checking Python version (2.*) (glob) (no-py3 !)
checking Python version (3.*) (glob) (py3 !)
Matt Harbison
run-tests: alias hg to hg.exe on Windows...
r41011 checking Python lib (.*[Ll]ib.*)... (re)
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 checking Python security support (*) (glob)
TLS 1.2 not supported by Python install; network connections lack modern security (?)
SNI not supported by Python install; may have connectivity issues with some servers (?)
checking Mercurial version (*) (glob)
checking Mercurial custom build (*) (glob)
checking module policy (*) (glob)
checking installed modules (*mercurial)... (glob)
checking registered compression engines (*zlib*) (glob)
checking available compression engines (*zlib*) (glob)
checking available compression engines for wire protocol (*zlib*) (glob)
checking "re2" regexp engine \((available|missing)\) (re)
checking templates (*mercurial?templates)... (glob)
checking default template (*mercurial?templates?map-cmdline.default) (glob)
Yuya Nishihara
debuginstall: do not parse editor command in posix way on Windows...
r36327 checking commit editor... (c:\foo\bar\baz.exe) (windows !)
Can't find editor 'c:\foo\bar\baz.exe' in PATH (windows !)
checking commit editor... (c:foobarbaz.exe) (no-windows !)
Can't find editor 'c:foobarbaz.exe' in PATH (no-windows !)
Kyle Lippincott
debugcommands: print out the editor that was searched for (post shlexsplit)...
r36254 (specify a commit editor in your configuration file)
checking username (test)
1 problems detected, please check your install!
[1]
Augie Fackler
fsmonitor: add support for extra `hg debuginstall` data...
r42879 debuginstall extension support
$ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman
fsmonitor checking for watchman binary... (false)
watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1
Verify the json works too:
$ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
"fsmonitor-watchman": "false",
"fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
Matt Harbison
test-install: perform the wix checking on wdir() instead of "."...
r27442 #if test-repo
timeless
tests: silence test-repo obsolete warning...
r29219 $ . "$TESTDIR/helpers-testrepo.sh"
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 $ cat >> wixxml.py << EOF
Matt Harbison
py3: fix module imports in tests, as flagged by test-check-module-imports.t...
r40405 > import os
> import subprocess
> import sys
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 > import xml.etree.ElementTree as ET
Gregory Szorc
tests: normalize to bytes in test-install.t...
r41348 > from mercurial import pycompat
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> # MSYS mangles the path if it expands $TESTDIR
> testdir = os.environ['TESTDIR']
> ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'}
>
> def directory(node, relpath):
> '''generator of files in the xml node, rooted at relpath'''
Yuya Nishihara
test-install: embed wix namespace for Python 2.6 compatibility...
r27519 > dirs = node.findall('./{%(wix)s}Directory' % ns)
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> for d in dirs:
> for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
> yield subfile
>
Yuya Nishihara
test-install: embed wix namespace for Python 2.6 compatibility...
r27519 > files = node.findall('./{%(wix)s}Component/{%(wix)s}File' % ns)
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> for f in files:
Gregory Szorc
tests: normalize to bytes in test-install.t...
r41348 > yield pycompat.sysbytes(relpath + f.attrib['Name'])
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> def hgdirectory(relpath):
> '''generator of tracked files, rooted at relpath'''
> hgdir = "%s/../mercurial" % (testdir)
Matt Harbison
test-install: perform the wix checking on wdir() instead of "."...
r27442 > args = ['hg', '--cwd', hgdir, 'files', relpath]
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 > proc = subprocess.Popen(args, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> output = proc.communicate()[0]
>
> for line in output.splitlines():
> if os.name == 'nt':
Matt Harbison
py3: fix a bytes/str mingling in test-install.t
r41431 > yield line.replace(pycompat.sysbytes(os.sep), b'/')
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 > else:
> yield line
>
> tracked = [f for f in hgdirectory(sys.argv[1])]
>
Gregory Szorc
wix: move contrib/wix to contrib/packaging/wix...
r42086 > xml = ET.parse("%s/../contrib/packaging/wix/%s.wxs" % (testdir, sys.argv[1]))
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 > root = xml.getroot()
Yuya Nishihara
test-install: embed wix namespace for Python 2.6 compatibility...
r27519 > dir = root.find('.//{%(wix)s}DirectoryRef' % ns)
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> installed = [f for f in directory(dir, '')]
>
> print('Not installed:')
> for f in sorted(set(tracked) - set(installed)):
Gregory Szorc
tests: normalize to bytes in test-install.t...
r41348 > print(' %s' % pycompat.sysstr(f))
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 >
> print('Not tracked:')
> for f in sorted(set(installed) - set(tracked)):
Gregory Szorc
tests: normalize to bytes in test-install.t...
r41348 > print(' %s' % pycompat.sysstr(f))
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 > EOF
Matt Harbison
tests: quote PYTHON usage...
r39743 $ ( testrepohgenv; "$PYTHON" wixxml.py help )
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 Not installed:
help/common.txt
Sean Farley
hg-ssh: copy doc string to man page...
r29090 help/hg-ssh.8.txt
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 help/hg.1.txt
help/hgignore.5.txt
help/hgrc.5.txt
Not tracked:
Matt Harbison
tests: quote PYTHON usage...
r39743 $ ( testrepohgenv; "$PYTHON" wixxml.py templates )
Matt Harbison
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
r27383 Not installed:
Not tracked:
Matt Harbison
test-install: perform the wix checking on wdir() instead of "."...
r27442
#endif
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727
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.
Gregory Szorc
tests: use venv on Python 3...
r43728 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.
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 $ cd $TESTTMP
Gregory Szorc
tests: use venv on Python 3...
r43728 $ 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
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 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.
Gregory Szorc
tests: use venv on Python 3...
r43728
Matt Harbison
tests: quote PYTHON usage...
r39743 $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log
Gregory Szorc
tests: add optional Python 2.7 deprecation output...
r41672 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. (?)
Gregory Szorc
tests: look for additional pip warning variant...
r43276 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 (?)
Gregory Szorc
tests: use venv on Python 3...
r43728
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 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.
Danek Duvall
tests: tell pip not to check for a newer version...
r32954 $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log
Gregory Szorc
tests: add optional output for Python 2.7 deprecation...
r42233 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. (?)
Gregory Szorc
tests: look for additional pip warning variant...
r43276 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 (?)
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 $ ./installenv/*/hg debuginstall || cat pip.log
checking encoding (ascii)...
checking Python executable (*) (glob)
Gregory Szorc
tests: use venv on Python 3...
r43728 checking Python version (2.*) (glob)
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 checking Python lib (*)... (glob)
checking Python security support (*) (glob)
TLS 1.2 not supported by Python install; network connections lack modern security (?)
SNI not supported by Python install; may have connectivity issues with some servers (?)
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)
Boris Feld
debuginstall: add a line about re2 availability...
r35464 checking "re2" regexp engine \((available|missing)\) (re)
Augie Fackler
tests: add a test for installing hg with pip in a virtualenv...
r32727 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