tests/test-install.t
changeset 43623 94eac340d212
parent 43622 45c15ed06f33
child 44145 0b475b0b0344
equal deleted inserted replaced
43622:45c15ed06f33 43623:94eac340d212
   160 Verify the json works too:
   160 Verify the json works too:
   161   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
   161   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
   162     "fsmonitor-watchman": "false",
   162     "fsmonitor-watchman": "false",
   163     "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
   163     "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
   164 
   164 
   165 
       
   166 #if test-repo
       
   167   $ . "$TESTDIR/helpers-testrepo.sh"
       
   168 
       
   169   $ cat >> wixxml.py << EOF
       
   170   > import os
       
   171   > import subprocess
       
   172   > import sys
       
   173   > import xml.etree.ElementTree as ET
       
   174   > from mercurial import pycompat
       
   175   > 
       
   176   > # MSYS mangles the path if it expands $TESTDIR
       
   177   > testdir = os.environ['TESTDIR']
       
   178   > ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'}
       
   179   > 
       
   180   > def directory(node, relpath):
       
   181   >     '''generator of files in the xml node, rooted at relpath'''
       
   182   >     dirs = node.findall('./{%(wix)s}Directory' % ns)
       
   183   > 
       
   184   >     for d in dirs:
       
   185   >         for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
       
   186   >             yield subfile
       
   187   > 
       
   188   >     files = node.findall('./{%(wix)s}Component/{%(wix)s}File' % ns)
       
   189   > 
       
   190   >     for f in files:
       
   191   >         yield pycompat.sysbytes(relpath + f.attrib['Name'])
       
   192   > 
       
   193   > def hgdirectory(relpath):
       
   194   >     '''generator of tracked files, rooted at relpath'''
       
   195   >     hgdir = "%s/../mercurial" % (testdir)
       
   196   >     args = ['hg', '--cwd', hgdir, 'files', relpath]
       
   197   >     proc = subprocess.Popen(args, stdout=subprocess.PIPE,
       
   198   >                             stderr=subprocess.PIPE)
       
   199   >     output = proc.communicate()[0]
       
   200   > 
       
   201   >     for line in output.splitlines():
       
   202   >         if os.name == 'nt':
       
   203   >             yield line.replace(pycompat.sysbytes(os.sep), b'/')
       
   204   >         else:
       
   205   >             yield line
       
   206   > 
       
   207   > tracked = [f for f in hgdirectory(sys.argv[1])]
       
   208   > 
       
   209   > xml = ET.parse("%s/../contrib/packaging/wix/%s.wxs" % (testdir, sys.argv[1]))
       
   210   > root = xml.getroot()
       
   211   > dir = root.find('.//{%(wix)s}DirectoryRef' % ns)
       
   212   > 
       
   213   > installed = [f for f in directory(dir, '')]
       
   214   > 
       
   215   > print('Not installed:')
       
   216   > for f in sorted(set(tracked) - set(installed)):
       
   217   >     print('  %s' % pycompat.sysstr(f))
       
   218   > 
       
   219   > print('Not tracked:')
       
   220   > for f in sorted(set(installed) - set(tracked)):
       
   221   >     print('  %s' % pycompat.sysstr(f))
       
   222   > EOF
       
   223 
       
   224   $ ( testrepohgenv; "$PYTHON" wixxml.py help )
       
   225   Not installed:
       
   226   Not tracked:
       
   227 
       
   228   $ ( testrepohgenv; "$PYTHON" wixxml.py templates )
       
   229   Not installed:
       
   230   Not tracked:
       
   231 
       
   232 #endif
       
   233 
       
   234 Verify that Mercurial is installable with pip. Note that this MUST be
   165 Verify that Mercurial is installable with pip. Note that this MUST be
   235 the last test in this file, because we do some nasty things to the
   166 the last test in this file, because we do some nasty things to the
   236 shell environment in order to make the virtualenv work reliably.
   167 shell environment in order to make the virtualenv work reliably.
   237 
   168 
   238 On Python 3, we use the venv module, which is part of the standard library.
   169 On Python 3, we use the venv module, which is part of the standard library.