##// END OF EJS Templates
run-tests: include non-activated venv packages in `PYTHONPATH`...
Matt Harbison -
r52901:d7e9503c default
parent child Browse files
Show More
@@ -3358,14 +3358,15 class TestRunner:
3358
3358
3359 # Setting PYTHONPATH with an activated venv causes the modules installed
3359 # Setting PYTHONPATH with an activated venv causes the modules installed
3360 # in it to be ignored. Therefore, include the related paths in sys.path
3360 # in it to be ignored. Therefore, include the related paths in sys.path
3361 # in PYTHONPATH.
3361 # in PYTHONPATH. If the executable is run directly without activation,
3362 virtual_env = osenvironb.get(b"VIRTUAL_ENV")
3362 # any modules installed in it would also be ignored, so include them for
3363 if virtual_env:
3363 # the same reason.
3364 virtual_env = os.path.join(virtual_env, b'')
3364
3365 for p in sys.path:
3365 for p in sys.path:
3366 p = _sys2bytes(p)
3366 if p.startswith(sys.exec_prefix):
3367 if p.startswith(virtual_env):
3367 path = _sys2bytes(p)
3368 pypath.append(p)
3368 if path not in pypath:
3369 pypath.append(path)
3369
3370
3370 # We have to augment PYTHONPATH, rather than simply replacing
3371 # We have to augment PYTHONPATH, rather than simply replacing
3371 # it, in case external libraries are only available via current
3372 # it, in case external libraries are only available via current
General Comments 0
You need to be logged in to leave comments. Login now