Mercurial > hg-stable
comparison tests/run-tests.py @ 35010:f948c5b3f5c9 stable
run-tests: avoid set PYTHONUSERBASE environment variable to None
According to python documentation, get_config_var can return None and it was
during running mercurial tests under a virtual environment with the local built
mercurial installed as a python package with `pip install -e .`.
On the other hand, if mercurial is installed in the user library folders with
`pip install --local -e .` the issue doesn't reproduce.
The fallback is that it will just set an empty string and everything should work
as before, according to https://www.python.org/dev/peps/pep-0370/:
The path to the user base directory can be overwritten with the environment
variable PYTHONUSERBASE. The default location is used when PYTHONUSERBASE is
not set or empty.
author | Mihai Popescu <mihai@unity3d.com> |
---|---|
date | Mon, 08 Jan 2018 13:52:43 +0100 |
parents | 8bce3e51b101 |
children | 87676e8ee056 |
comparison
equal
deleted
inserted
replaced
35009:d1aae6d4efc5 | 35010:f948c5b3f5c9 |
---|---|
1019 """Obtain environment variables to use during test execution.""" | 1019 """Obtain environment variables to use during test execution.""" |
1020 def defineport(i): | 1020 def defineport(i): |
1021 offset = '' if i == 0 else '%s' % i | 1021 offset = '' if i == 0 else '%s' % i |
1022 env["HGPORT%s" % offset] = '%s' % (self._startport + i) | 1022 env["HGPORT%s" % offset] = '%s' % (self._startport + i) |
1023 env = os.environ.copy() | 1023 env = os.environ.copy() |
1024 env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') | 1024 env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or '' |
1025 env['HGEMITWARNINGS'] = '1' | 1025 env['HGEMITWARNINGS'] = '1' |
1026 env['TESTTMP'] = self._testtmp | 1026 env['TESTTMP'] = self._testtmp |
1027 env['HOME'] = self._testtmp | 1027 env['HOME'] = self._testtmp |
1028 # This number should match portneeded in _getport | 1028 # This number should match portneeded in _getport |
1029 for port in xrange(3): | 1029 for port in xrange(3): |