summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-08-21 13:34:09 +0200
committerholger krekel <holger@merlinux.eu>2013-08-21 13:34:09 +0200
commitfe2a897abb8a981c2ca1cdae390b50cd3214bfe0 (patch)
tree8a866d730a2fa1c6ab9809d95d0e838775913db5
parentdc037b5232ab02206be96bd219ec173983aee0b8 (diff)
downloadtox-fe2a897abb8a981c2ca1cdae390b50cd3214bfe0.tar.gz
fix issue116: make 1.6 introduced behaviour of changing to a
per-env HOME directory during install activities dependent on "--set-home" for now. Should re-establish the old behaviour.
-rwxr-xr-xCHANGELOG4
-rw-r--r--setup.py2
-rw-r--r--tests/test_venv.py18
-rw-r--r--tox/__init__.py2
-rw-r--r--tox/_config.py4
-rw-r--r--tox/_venv.py10
6 files changed, 35 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e234c46..01ddcfa 100755
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,10 @@
- fix issue119: {envsitepackagesdir} is now correctly computed and has
a better test to prevent regression.
+- fix issue116: make 1.6 introduced behaviour of changing to a
+ per-env HOME directory during install activities dependent
+ on "--set-home" for now. Should re-establish the old behaviour
+ when no option is given.
1.6.0
-----------------
diff --git a/setup.py b/setup.py
index c0f24eb..9994e26 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ def main():
description='virtualenv-based automation of test activities',
long_description=open("README.rst").read(),
url='http://tox.testrun.org/',
- version='1.6.0',
+ version='1.6.1',
license='http://opensource.org/licenses/MIT',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='holger krekel',
diff --git a/tests/test_venv.py b/tests/test_venv.py
index e6792ed..4a03b03 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -568,6 +568,24 @@ def test_command_relative_issue26(newmocksession, tmpdir, monkeypatch):
x4 = venv.getcommandpath("x", cwd=tmpdir)
mocksession.report.expect("warning", "*test command found but not*")
+def test_sethome_only_on_option(newmocksession, monkeypatch):
+ mocksession = newmocksession([], "")
+ venv = mocksession.getenv('python')
+ action = mocksession.newaction(venv, "qwe", [])
+ monkeypatch.setattr(tox._venv, "hack_home_env", None)
+ venv._install(["x"], action=action)
+
+def test_sethome_works_on_option(newmocksession, monkeypatch):
+ mocksession = newmocksession(["--set-home", "-i ALL=http://qwe"], "")
+ venv = mocksession.getenv('python')
+ action = mocksession.newaction(venv, "qwe", [])
+ venv._install(["x"], action=action)
+ _, mocked = mocksession.report.getnext("logpopen")
+ p = mocked.env["HOME"]
+ pydist = py.path.local(p).join(".pydistutils.cfg")
+ assert "http://qwe" in pydist.read()
+
+
def test_hack_home_env(tmpdir):
from tox._venv import hack_home_env
env = hack_home_env(tmpdir, "http://index")
diff --git a/tox/__init__.py b/tox/__init__.py
index f37c663..2aebea5 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -1,5 +1,5 @@
#
-__version__ = '1.6.0'
+__version__ = '1.6.1'
class exception:
class Error(Exception):
diff --git a/tox/_config.py b/tox/_config.py
index a9351d9..c259c42 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -99,6 +99,10 @@ def prepare_parse(pkgname):
parser.add_argument("--develop", action="store_true", dest="develop",
help="install package in the venv using 'setup.py develop' via "
"'pip -e .'")
+ parser.add_argument("--set-home", action="store_true", dest="sethome",
+ help="(experimental) force creating a new $HOME for each test "
+ "environment and create .pydistutils.cfg|pip.conf files "
+ "if index servers are specified with tox. ")
parser.add_argument('-i', action="append",
dest="indexurl", metavar="URL",
help="set indexserver url (if URL is of form name=url set the "
diff --git a/tox/_venv.py b/tox/_venv.py
index d2f2ab3..d67ddb9 100644
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -322,9 +322,13 @@ class VirtualEnv(object):
extraopts = extraopts or []
for ixserver in l:
- extraenv = hack_home_env(
- homedir=self.envconfig.envtmpdir.join("pseudo-home"),
- index_url = ixserver.url)
+ if self.envconfig.config.option.sethome:
+ extraenv = hack_home_env(
+ homedir=self.envconfig.envtmpdir.join("pseudo-home"),
+ index_url = ixserver.url)
+ else:
+ extraenv = {}
+
args = d[ixserver] + extraopts
self.run_install_command(args, ixserver.url, action,
extraenv=extraenv)