holger krekel avatar holger krekel committed df42ff8

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.

Comments (0)

Files changed (6)

 - 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
 -----------------
         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',

tests/test_venv.py

     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")
 #
-__version__ = '1.6.0'
+__version__ = '1.6.1'
 
 class exception:
     class Error(Exception):
     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 "
 
         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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.