run-tests: detect active virtualenv (
bug 1357201); r?glob
Upcoming patches will make run-tests behave a bit more intelligently
depending on the current virtualenv. In order to do that, we need
to detect the current virtualenv. This commit adds code to do that.
MozReview-Commit-ID: 9PWE4SBMGqr
--- a/run-tests
+++ b/run-tests
@@ -21,16 +21,26 @@ EXTDIR = os.path.join(HERE, 'hgext')
if __name__ == '__main__':
if 'VIRTUAL_ENV' not in os.environ:
activate = os.path.join(HERE, 'venv', 'bin', 'activate_this.py')
execfile(activate, dict(__file__=activate))
sys.executable = os.path.join(HERE, 'venv', 'bin', 'python')
os.environ['VIRTUAL_ENV'] = os.path.join(HERE, 'venv')
+ venv_name = os.path.relpath(os.environ['VIRTUAL_ENV'],
+ os.path.join(HERE, 'venv'))
+
+ if venv_name == '.':
+ venv_name = 'global'
+
+ if venv_name not in ('global', 'vcssync'):
+ print('unknown virtualenv: %s (this should not happen)' % venv_name)
+ sys.exit(1)
+
try:
import vcttesting.docker as vctdocker
except ImportError:
vctdocker = None
from vcttesting.testing import (
get_docker_state,
get_extensions,