Mercurial > hg
comparison tests/run-tests.py @ 46068:9e785d940525
run-tests: extend PATH on Windows to include user installed scripts
This allows the test environment to see pylint.exe when installed with
`pip install --user`, since it isn't normally on PATH.
Differential Revision: https://phab.mercurial-scm.org/D9535
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 07 Dec 2020 16:32:30 -0500 |
parents | cc0b332ab9fc |
children | af3a6900f893 |
comparison
equal
deleted
inserted
replaced
46067:cc0b332ab9fc | 46068:9e785d940525 |
---|---|
3482 % (exename, pyexename, exedir) | 3482 % (exename, pyexename, exedir) |
3483 ) | 3483 ) |
3484 path = os.environ['PATH'].split(os.pathsep) | 3484 path = os.environ['PATH'].split(os.pathsep) |
3485 while exedir in path: | 3485 while exedir in path: |
3486 path.remove(exedir) | 3486 path.remove(exedir) |
3487 os.environ['PATH'] = os.pathsep.join([exedir] + path) | 3487 |
3488 # Binaries installed by pip into the user area like pylint.exe may | |
3489 # not be in PATH by default. | |
3490 extra_paths = [exedir] | |
3491 vi = sys.version_info | |
3492 if 'APPDATA' in os.environ: | |
3493 scripts_dir = os.path.join( | |
3494 os.environ['APPDATA'], | |
3495 'Python', | |
3496 'Python%d%d' % (vi[0], vi[1]), | |
3497 'Scripts', | |
3498 ) | |
3499 | |
3500 if vi.major == 2: | |
3501 scripts_dir = os.path.join( | |
3502 os.environ['APPDATA'], | |
3503 'Python', | |
3504 'Scripts', | |
3505 ) | |
3506 | |
3507 extra_paths.append(scripts_dir) | |
3508 | |
3509 os.environ['PATH'] = os.pathsep.join(extra_paths + path) | |
3488 if not self._findprogram(pyexename): | 3510 if not self._findprogram(pyexename): |
3489 print("WARNING: Cannot find %s in search path" % pyexename) | 3511 print("WARNING: Cannot find %s in search path" % pyexename) |
3490 | 3512 |
3491 def _installhg(self): | 3513 def _installhg(self): |
3492 """Install hg into the test environment. | 3514 """Install hg into the test environment. |