Mercurial > hg
comparison tests/run-tests.py @ 25729:57dfadc4f46c
run-tests.py: add RUNTESTDIR to refer `tests` of Mercurial
Before this patch, there is no way to refer files under `tests` or so
of Mercurial source tree, when `run-tests.py` runs in `tests` of third
party tools. In this case, `TESTDIR` refers the latter `tests`.
This prevents third party tools from using useful tools in Mercurial
source tree (e.g. `contrib/check-code.py`).
This patch adds `RUNTESTDIR` environment variable to refer `tests` of
Mercurial source tree, in which `run-tests.py` now running is
placed. For example, tests of third party tools can refer
`contrib/check-code.py` in Mercurial source tree as
`$RUNTESTDIR/../contrib/check-code.py`.
BTW, for similarity with `TESTDIR` referring `test*s*` directory,
newly added environment variable isn't named as `RUNTEST*S*DIR`. In
addition to it, the corresponded local variable is also named as
`runtestdir`.
This is a one of preparations for issue4677.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 03 Jul 2015 06:56:03 +0900 |
parents | 905c32321cfb |
children | c380d5273e91 |
comparison
equal
deleted
inserted
replaced
25728:905c32321cfb | 25729:57dfadc4f46c |
---|---|
1799 osenvironb[b"BINDIR"] = self._bindir | 1799 osenvironb[b"BINDIR"] = self._bindir |
1800 osenvironb[b"PYTHON"] = PYTHON | 1800 osenvironb[b"PYTHON"] = PYTHON |
1801 | 1801 |
1802 fileb = _bytespath(__file__) | 1802 fileb = _bytespath(__file__) |
1803 runtestdir = os.path.abspath(os.path.dirname(fileb)) | 1803 runtestdir = os.path.abspath(os.path.dirname(fileb)) |
1804 osenvironb[b'RUNTESTDIR'] = runtestdir | |
1804 if PYTHON3: | 1805 if PYTHON3: |
1805 sepb = _bytespath(os.pathsep) | 1806 sepb = _bytespath(os.pathsep) |
1806 else: | 1807 else: |
1807 sepb = os.pathsep | 1808 sepb = os.pathsep |
1808 path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) | 1809 path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) |
1833 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure" | 1834 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure" |
1834 | 1835 |
1835 self._coveragefile = os.path.join(self._testdir, b'.coverage') | 1836 self._coveragefile = os.path.join(self._testdir, b'.coverage') |
1836 | 1837 |
1837 vlog("# Using TESTDIR", self._testdir) | 1838 vlog("# Using TESTDIR", self._testdir) |
1839 vlog("# Using RUNTESTDIR", osenvironb[b'RUNTESTDIR']) | |
1838 vlog("# Using HGTMP", self._hgtmp) | 1840 vlog("# Using HGTMP", self._hgtmp) |
1839 vlog("# Using PATH", os.environ["PATH"]) | 1841 vlog("# Using PATH", os.environ["PATH"]) |
1840 vlog("# Using", IMPL_PATH, osenvironb[IMPL_PATH]) | 1842 vlog("# Using", IMPL_PATH, osenvironb[IMPL_PATH]) |
1841 | 1843 |
1842 try: | 1844 try: |