equal
deleted
inserted
replaced
442 |
442 |
443 def __init__(self, path, tmpdir, keeptmpdir=False, |
443 def __init__(self, path, tmpdir, keeptmpdir=False, |
444 debug=False, |
444 debug=False, |
445 timeout=defaults['timeout'], |
445 timeout=defaults['timeout'], |
446 startport=defaults['port'], extraconfigopts=None, |
446 startport=defaults['port'], extraconfigopts=None, |
447 py3kwarnings=False, shell=None, |
447 py3kwarnings=False, shell=None, hgcommand=None, |
448 slowtimeout=defaults['slowtimeout']): |
448 slowtimeout=defaults['slowtimeout']): |
449 """Create a test from parameters. |
449 """Create a test from parameters. |
450 |
450 |
451 path is the full path to the file defining the test. |
451 path is the full path to the file defining the test. |
452 |
452 |
489 self._slowtimeout = slowtimeout |
489 self._slowtimeout = slowtimeout |
490 self._startport = startport |
490 self._startport = startport |
491 self._extraconfigopts = extraconfigopts or [] |
491 self._extraconfigopts = extraconfigopts or [] |
492 self._py3kwarnings = py3kwarnings |
492 self._py3kwarnings = py3kwarnings |
493 self._shell = _bytespath(shell) |
493 self._shell = _bytespath(shell) |
|
494 self._hgcommand = hgcommand or b'hg' |
494 |
495 |
495 self._aborted = False |
496 self._aborted = False |
496 self._daemonpids = [] |
497 self._daemonpids = [] |
497 self._finished = None |
498 self._finished = None |
498 self._ret = None |
499 self._ret = None |
987 # can generate the surrounding doctest magic. |
988 # can generate the surrounding doctest magic. |
988 inpython = False |
989 inpython = False |
989 |
990 |
990 if self._debug: |
991 if self._debug: |
991 script.append(b'set -x\n') |
992 script.append(b'set -x\n') |
|
993 if self._hgcommand != b'hg': |
|
994 script.append(b'alias hg="%s"\n' % self._hgcommand) |
992 if os.getenv('MSYSTEM'): |
995 if os.getenv('MSYSTEM'): |
993 script.append(b'alias pwd="pwd -W"\n') |
996 script.append(b'alias pwd="pwd -W"\n') |
994 |
997 |
995 for n, l in enumerate(lines): |
998 for n, l in enumerate(lines): |
996 if not l.endswith(b'\n'): |
999 if not l.endswith(b'\n'): |
1815 self._bindir = None |
1818 self._bindir = None |
1816 self._tmpbinddir = None |
1819 self._tmpbinddir = None |
1817 self._pythondir = None |
1820 self._pythondir = None |
1818 self._coveragefile = None |
1821 self._coveragefile = None |
1819 self._createdfiles = [] |
1822 self._createdfiles = [] |
|
1823 self._hgcommand = None |
1820 self._hgpath = None |
1824 self._hgpath = None |
1821 self._portoffset = 0 |
1825 self._portoffset = 0 |
1822 self._ports = {} |
1826 self._ports = {} |
1823 |
1827 |
1824 def run(self, args, parser=None): |
1828 def run(self, args, parser=None): |
1923 if self.options.with_hg: |
1927 if self.options.with_hg: |
1924 self._installdir = None |
1928 self._installdir = None |
1925 whg = self.options.with_hg |
1929 whg = self.options.with_hg |
1926 self._bindir = os.path.dirname(os.path.realpath(whg)) |
1930 self._bindir = os.path.dirname(os.path.realpath(whg)) |
1927 assert isinstance(self._bindir, bytes) |
1931 assert isinstance(self._bindir, bytes) |
|
1932 self._hgcommand = os.path.basename(whg) |
1928 self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin') |
1933 self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin') |
1929 os.makedirs(self._tmpbindir) |
1934 os.makedirs(self._tmpbindir) |
1930 |
1935 |
1931 # This looks redundant with how Python initializes sys.path from |
1936 # This looks redundant with how Python initializes sys.path from |
1932 # the location of the script being executed. Needed because the |
1937 # the location of the script being executed. Needed because the |
1935 # ... which means it's not really redundant at all. |
1940 # ... which means it's not really redundant at all. |
1936 self._pythondir = self._bindir |
1941 self._pythondir = self._bindir |
1937 else: |
1942 else: |
1938 self._installdir = os.path.join(self._hgtmp, b"install") |
1943 self._installdir = os.path.join(self._hgtmp, b"install") |
1939 self._bindir = os.path.join(self._installdir, b"bin") |
1944 self._bindir = os.path.join(self._installdir, b"bin") |
|
1945 self._hgcommand = b'hg' |
1940 self._tmpbindir = self._bindir |
1946 self._tmpbindir = self._bindir |
1941 self._pythondir = os.path.join(self._installdir, b"lib", b"python") |
1947 self._pythondir = os.path.join(self._installdir, b"lib", b"python") |
1942 |
1948 |
1943 osenvironb[b"BINDIR"] = self._bindir |
1949 osenvironb[b"BINDIR"] = self._bindir |
1944 osenvironb[b"PYTHON"] = PYTHON |
1950 osenvironb[b"PYTHON"] = PYTHON |
2115 debug=self.options.debug, |
2121 debug=self.options.debug, |
2116 timeout=self.options.timeout, |
2122 timeout=self.options.timeout, |
2117 startport=self._getport(count), |
2123 startport=self._getport(count), |
2118 extraconfigopts=self.options.extra_config_opt, |
2124 extraconfigopts=self.options.extra_config_opt, |
2119 py3kwarnings=self.options.py3k_warnings, |
2125 py3kwarnings=self.options.py3k_warnings, |
2120 shell=self.options.shell) |
2126 shell=self.options.shell, |
|
2127 hgcommand=self._hgcommand) |
2121 t.should_reload = True |
2128 t.should_reload = True |
2122 return t |
2129 return t |
2123 |
2130 |
2124 def _cleanup(self): |
2131 def _cleanup(self): |
2125 """Clean up state from this test invocation.""" |
2132 """Clean up state from this test invocation.""" |