Mercurial > hg
comparison tests/run-tests.py @ 33115:fa9a90d5ad89
tests: save the original PATH and PYTHONPATH variables
When running the tests, define ORIG_PATH and ORIG_PYTHONPATH environment
variables that contain the original contents of PATH and PYTHONPATH, before
they were modified by run-tests.py
This will make it possible for tests to refer to the original contents of these
variables if necessary. In particular, this is necessary for invoking the
correct version of hg for examining the local repository (the mercurial
repository itself, not the temporary test repositories). Various tests examine
the local repository to check the file lists and contents of commit messages.
author | Adam Simpkins <simpkins@fb.com> |
---|---|
date | Tue, 27 Jun 2017 17:24:31 -0700 |
parents | 573baab2a797 |
children | 98e2c78e309c |
comparison
equal
deleted
inserted
replaced
33114:8b20338b989e | 33115:fa9a90d5ad89 |
---|---|
2272 osenvironb[b'RUNTESTDIR'] = runtestdir | 2272 osenvironb[b'RUNTESTDIR'] = runtestdir |
2273 if PYTHON3: | 2273 if PYTHON3: |
2274 sepb = _bytespath(os.pathsep) | 2274 sepb = _bytespath(os.pathsep) |
2275 else: | 2275 else: |
2276 sepb = os.pathsep | 2276 sepb = os.pathsep |
2277 # save the original path, for tests that need to invoke the | |
2278 # system python | |
2279 osenvironb[b"ORIG_PATH"] = osenvironb[b"PATH"] | |
2277 path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) | 2280 path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) |
2278 if os.path.islink(__file__): | 2281 if os.path.islink(__file__): |
2279 # test helper will likely be at the end of the symlink | 2282 # test helper will likely be at the end of the symlink |
2280 realfile = os.path.realpath(fileb) | 2283 realfile = os.path.realpath(fileb) |
2281 realdir = os.path.abspath(os.path.dirname(realfile)) | 2284 realdir = os.path.abspath(os.path.dirname(realfile)) |
2297 # it, in case external libraries are only available via current | 2300 # it, in case external libraries are only available via current |
2298 # PYTHONPATH. (In particular, the Subversion bindings on OS X | 2301 # PYTHONPATH. (In particular, the Subversion bindings on OS X |
2299 # are in /opt/subversion.) | 2302 # are in /opt/subversion.) |
2300 oldpypath = osenvironb.get(IMPL_PATH) | 2303 oldpypath = osenvironb.get(IMPL_PATH) |
2301 if oldpypath: | 2304 if oldpypath: |
2305 osenvironb['ORIG_' + IMPL_PATH] = oldpypath | |
2302 pypath.append(oldpypath) | 2306 pypath.append(oldpypath) |
2303 osenvironb[IMPL_PATH] = sepb.join(pypath) | 2307 osenvironb[IMPL_PATH] = sepb.join(pypath) |
2304 | 2308 |
2305 if self.options.pure: | 2309 if self.options.pure: |
2306 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure" | 2310 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure" |