[Pytest-commit] commit/tox: 4 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Dec 9 07:33:49 EST 2015


4 new commits in tox:

https://bitbucket.org/hpk42/tox/commits/2e58464b95ee/
Changeset:   2e58464b95ee
User:        hpk42
Date:        2015-12-09 10:53:22+00:00
Summary:     internal: push some optional object creation into tests because
tox core doesn't need it.
Affected #:  4 files

diff -r 42e1c6cb4b798b78b632915e1246ca5c83767963 -r 2e58464b95eed4d93ef05e2b396aed5219daa09a CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,8 @@
 - fix issue252: allow environment names with special characters.
   Thanks Julien Castets for initial PR and patience.
 
+- internal: push some optional object creation into tests because
+  tox core doesn't need it.
 
 2.2.1
 -----

diff -r 42e1c6cb4b798b78b632915e1246ca5c83767963 -r 2e58464b95eed4d93ef05e2b396aed5219daa09a tests/test_venv.py
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -56,7 +56,8 @@
     venv = VirtualEnv(envconfig, session=mocksession)
     assert venv.path == envconfig.envdir
     assert not venv.path.check()
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -96,7 +97,8 @@
     """)
     envconfig = config.envconfigs['site']
     venv = VirtualEnv(envconfig, session=mocksession)
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -105,7 +107,8 @@
 
     envconfig = config.envconfigs['nosite']
     venv = VirtualEnv(envconfig, session=mocksession)
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -122,14 +125,15 @@
             {distshare}/dep1-*
     """)
     venv = mocksession.getenv("py123")
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) == 1
     distshare = venv.session.config.distshare
     distshare.ensure("dep1-1.0.zip")
     distshare.ensure("dep1-1.1.zip")
 
-    venv.install_deps()
+    venv.install_deps(action)
     assert len(l) == 2
     args = l[-1].args
     assert l[-1].cwd == venv.envconfig.config.toxinidir
@@ -154,11 +158,12 @@
             dep2
     """)
     venv = mocksession.getenv("py123")
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) == 1
 
-    venv.install_deps()
+    venv.install_deps(action)
     assert len(l) == 2
     args = l[-1].args
     assert l[-1].cwd == venv.envconfig.config.toxinidir
@@ -183,12 +188,13 @@
             :abc2:dep3
     """)
     venv = mocksession.getenv('py123')
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) == 1
     l[:] = []
 
-    venv.install_deps()
+    venv.install_deps(action)
     # two different index servers, two calls
     assert len(l) == 3
     args = " ".join(l[0].args)
@@ -211,12 +217,13 @@
             dep1
     """)
     venv = mocksession.getenv('python')
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) == 1
     l[:] = []
 
-    venv.install_deps()
+    venv.install_deps(action)
     assert len(l) == 1
     args = " ".join(l[0].args)
     assert "--pre " in args
@@ -246,10 +253,12 @@
         deps=xyz
     """)
     venv = mocksession.getenv('python')
-    venv.update()
+
+    action = mocksession.newaction(venv, "update")
+    venv.update(action)
     mocksession.installpkg(venv, pkg)
     mocksession.report.expect("verbosity0", "*create*")
-    venv.update()
+    venv.update(action)
     mocksession.report.expect("verbosity0", "*recreate*")
 
 
@@ -263,7 +272,8 @@
     finally:
         tox.config.make_hashseed = original_make_hashseed
     venv = mocksession.getenv('python')
-    venv.update()
+    action = mocksession.newaction(venv, "update")
+    venv.update(action)
     venv.test()
     mocksession.report.expect("verbosity0", "python runtests: PYTHONHASHSEED='123456789'")
 
@@ -274,7 +284,8 @@
         commands = echo foo bar
     ''')
     venv = mocksession.getenv('python')
-    venv.update()
+    action = mocksession.newaction(venv, "update")
+    venv.update(action)
     venv.test()
     mocksession.report.expect("verbosity0", "*runtests*commands?0? | echo foo bar")
 
@@ -343,7 +354,8 @@
             dep2
     """)
     venv = mocksession.getenv('py123')
-    venv.create()
+    action = mocksession.newaction(venv, "getenv")
+    venv.create(action)
     l = mocksession._pcalls
     assert len(l) == 1
     args = l[0].args
@@ -429,7 +441,8 @@
         envconfig = config.envconfigs['python']
         venv = VirtualEnv(envconfig, session=mocksession)
         cconfig = venv._getliveconfig()
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         assert not venv.path_config.check()
         mocksession.installpkg(venv, pkg)
         assert venv.path_config.check()
@@ -439,36 +452,42 @@
         mocksession.report.expect("*", "*create*")
         # modify config and check that recreation happens
         mocksession._clearmocks()
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         mocksession.report.expect("*", "*reusing*")
         mocksession._clearmocks()
+        action = mocksession.newaction(venv, "update")
         cconfig.python = py.path.local("balla")
         cconfig.writeconfig(venv.path_config)
-        venv.update()
+        venv.update(action)
         mocksession.report.expect("verbosity0", "*recreate*")
 
     def test_dep_recreation(self, newconfig, mocksession):
         config = newconfig([], "")
         envconfig = config.envconfigs['python']
         venv = VirtualEnv(envconfig, session=mocksession)
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         cconfig = venv._getliveconfig()
         cconfig.deps[:] = [("1" * 32, "xyz.zip")]
         cconfig.writeconfig(venv.path_config)
         mocksession._clearmocks()
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         mocksession.report.expect("*", "*recreate*")
 
     def test_develop_recreation(self, newconfig, mocksession):
         config = newconfig([], "")
         envconfig = config.envconfigs['python']
         venv = VirtualEnv(envconfig, session=mocksession)
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         cconfig = venv._getliveconfig()
         cconfig.usedevelop = True
         cconfig.writeconfig(venv.path_config)
         mocksession._clearmocks()
-        venv.update()
+        action = mocksession.newaction(venv, "update")
+        venv.update(action)
         mocksession.report.expect("verbosity0", "*recreate*")
 
 
@@ -481,21 +500,25 @@
             commands=abc
         """)
         venv = mocksession.getenv("python")
+        action = mocksession.newaction(venv, "getenv")
         monkeypatch.setenv("PATH", "xyz")
         l = []
         monkeypatch.setattr("py.path.local.sysfind", classmethod(
                             lambda *args, **kwargs: l.append(kwargs) or 0 / 0))
 
-        py.test.raises(ZeroDivisionError, "venv._install(list('123'))")
+        with pytest.raises(ZeroDivisionError):
+            venv._install(list('123'), action=action)
         assert l.pop()["paths"] == [venv.envconfig.envbindir]
-        py.test.raises(ZeroDivisionError, "venv.test()")
+        with pytest.raises(ZeroDivisionError):
+            venv.test(action)
         assert l.pop()["paths"] == [venv.envconfig.envbindir]
-        py.test.raises(ZeroDivisionError, "venv.run_install_command(['qwe'])")
+        with pytest.raises(ZeroDivisionError):
+            venv.run_install_command(['qwe'], action=action)
         assert l.pop()["paths"] == [venv.envconfig.envbindir]
         monkeypatch.setenv("PIP_RESPECT_VIRTUALENV", "1")
         monkeypatch.setenv("PIP_REQUIRE_VIRTUALENV", "1")
         monkeypatch.setenv("__PYVENV_LAUNCHER__", "1")
-        py.test.raises(ZeroDivisionError, "venv.run_install_command(['qwe'])")
+        py.test.raises(ZeroDivisionError, "venv.run_install_command(['qwe'], action=action)")
         assert 'PIP_RESPECT_VIRTUALENV' not in os.environ
         assert 'PIP_REQUIRE_VIRTUALENV' not in os.environ
         assert '__PYVENV_LAUNCHER__' not in os.environ

diff -r 42e1c6cb4b798b78b632915e1246ca5c83767963 -r 2e58464b95eed4d93ef05e2b396aed5219daa09a tests/test_z_cmdline.py
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -34,7 +34,8 @@
     report = session.report
     report.expect("using")
     venv = session.getvenv("mypython")
-    venv.update()
+    action = session.newaction(venv, "update")
+    venv.update(action)
     report.expect("logpopen")
 
 

diff -r 42e1c6cb4b798b78b632915e1246ca5c83767963 -r 2e58464b95eed4d93ef05e2b396aed5219daa09a tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -114,12 +114,10 @@
     def _ispython3(self):
         return "python3" in str(self.envconfig.basepython)
 
-    def update(self, action=None):
+    def update(self, action):
         """ return status string for updating actual venv to match configuration.
             if status string is empty, all is ok.
         """
-        if action is None:
-            action = self.session.newaction(self, "update")
         rconfig = CreationConfig.readconfig(self.path_config)
         if not self.envconfig.recreate and rconfig and \
            rconfig.matches(self._getliveconfig()):
@@ -172,12 +170,9 @@
     def matching_platform(self):
         return re.match(self.envconfig.platform, sys.platform)
 
-    def create(self, action=None):
+    def create(self, action):
         # if self.getcommandpath("activate").dirpath().check():
         #    return
-        if action is None:
-            action = self.session.newaction(self, "create")
-
         config_interpreter = self.getsupportedinterpreter()
         args = [sys.executable, '-m', 'virtualenv']
         if self.envconfig.sitepackages:
@@ -239,9 +234,7 @@
             extraopts = ['-U', '--no-deps']
         self._install([sdistpath], extraopts=extraopts, action=action)
 
-    def install_deps(self, action=None):
-        if action is None:
-            action = self.session.newaction(self, "install_deps")
+    def install_deps(self, action):
         deps = self._getresolvedeps()
         if deps:
             depinfo = ", ".join(map(str, deps))
@@ -259,7 +252,7 @@
             l.append("--pre")
         return l
 
-    def run_install_command(self, packages, options=(), action=None):
+    def run_install_command(self, packages, action, options=()):
         argv = self.envconfig.install_command[:]
         # use pip-script on win32 to avoid the executable locking
         i = argv.index('{packages}')


https://bitbucket.org/hpk42/tox/commits/0823f359a05b/
Changeset:   0823f359a05b
User:        hpk42
Date:        2015-12-09 11:05:51+00:00
Summary:     some small refactorings
Affected #:  2 files

diff -r 2e58464b95eed4d93ef05e2b396aed5219daa09a -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 tox/session.py
--- a/tox/session.py
+++ b/tox/session.py
@@ -211,7 +211,7 @@
         if sys.platform == "win32":
             ext = os.path.splitext(str(newargs[0]))[1].lower()
             if ext == '.py' and self.venv:
-                newargs = [str(self.venv.getcommandpath())] + newargs
+                newargs = [str(self.envconfig.envpython)] + newargs
 
         return newargs
 

diff -r 2e58464b95eed4d93ef05e2b396aed5219daa09a -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -56,19 +56,29 @@
     def __init__(self, envconfig=None, session=None):
         self.envconfig = envconfig
         self.session = session
-        self.path = envconfig.envdir
-        self.path_config = self.path.join(".tox-config1")
+
+    @property
+    def path(self):
+        """ Path to environment base dir. """
+        return self.envconfig.envdir
+
+    @property
+    def path_config(self):
+        return self.path.join(".tox-config1")
 
     @property
     def name(self):
+        """ test environment name. """
         return self.envconfig.envname
 
     def __repr__(self):
         return "<VirtualEnv at %r>" % (self.path)
 
-    def getcommandpath(self, name=None, venv=True, cwd=None):
-        if name is None:
-            return self.envconfig.envpython
+    def getcommandpath(self, name, venv=True, cwd=None):
+        """ return absolute path (str or localpath) for specified
+        command name.  If venv is True we will check if the
+        command is coming from the venv or is whitelisted to come
+        from external. """
         name = str(name)
         if os.path.isabs(name):
             return name


https://bitbucket.org/hpk42/tox/commits/ba0ff401e037/
Changeset:   ba0ff401e037
User:        hpk42
Date:        2015-12-09 12:13:32+00:00
Summary:     implement new experimental hooks for venv creation
Affected #:  8 files

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,13 @@
 - fix issue252: allow environment names with special characters.
   Thanks Julien Castets for initial PR and patience.
 
+- introduce experimental tox_testenv_create(venv, action) and 
+  tox_testenv_install_deps(venv, action) hooks to allow
+  plugins to do additional work on creation or installing
+  deps.  These hooks are experimental mainly because of
+  the involved "venv" object whose current public API is not 
+  fully guranteed.
+
 - internal: push some optional object creation into tests because
   tox core doesn't need it.
 

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df doc/plugins.txt
--- a/doc/plugins.txt
+++ b/doc/plugins.txt
@@ -80,3 +80,9 @@
 
 .. autoclass:: tox.config.TestenvConfig()
     :members:
+
+.. autoclass:: tox.venv.VirtualEnv()
+    :members:
+
+.. autoclass:: tox.session.Session()
+    :members:

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tests/test_venv.py
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -57,7 +57,7 @@
     assert venv.path == envconfig.envdir
     assert not venv.path.check()
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -98,7 +98,7 @@
     envconfig = config.envconfigs['site']
     venv = VirtualEnv(envconfig, session=mocksession)
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -108,7 +108,7 @@
     envconfig = config.envconfigs['nosite']
     venv = VirtualEnv(envconfig, session=mocksession)
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) >= 1
     args = l[0].args
@@ -126,14 +126,14 @@
     """)
     venv = mocksession.getenv("py123")
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) == 1
     distshare = venv.session.config.distshare
     distshare.ensure("dep1-1.0.zip")
     distshare.ensure("dep1-1.1.zip")
 
-    venv.install_deps(action)
+    tox_testenv_install_deps(action=action, venv=venv)
     assert len(l) == 2
     args = l[-1].args
     assert l[-1].cwd == venv.envconfig.config.toxinidir
@@ -159,11 +159,11 @@
     """)
     venv = mocksession.getenv("py123")
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) == 1
 
-    venv.install_deps(action)
+    tox_testenv_install_deps(action=action, venv=venv)
     assert len(l) == 2
     args = l[-1].args
     assert l[-1].cwd == venv.envconfig.config.toxinidir
@@ -189,12 +189,12 @@
     """)
     venv = mocksession.getenv('py123')
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) == 1
     l[:] = []
 
-    venv.install_deps(action)
+    tox_testenv_install_deps(action=action, venv=venv)
     # two different index servers, two calls
     assert len(l) == 3
     args = " ".join(l[0].args)
@@ -218,12 +218,12 @@
     """)
     venv = mocksession.getenv('python')
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) == 1
     l[:] = []
 
-    venv.install_deps(action)
+    tox_testenv_install_deps(action=action, venv=venv)
     assert len(l) == 1
     args = " ".join(l[0].args)
     assert "--pre " in args
@@ -355,7 +355,7 @@
     """)
     venv = mocksession.getenv('py123')
     action = mocksession.newaction(venv, "getenv")
-    venv.create(action)
+    tox_testenv_create(action=action, venv=venv)
     l = mocksession._pcalls
     assert len(l) == 1
     args = l[0].args
@@ -649,3 +649,26 @@
     assert venv.status == "ignored failed command"
     mocksession.report.expect("warning", "*command failed but result from "
                                          "testenv is ignored*")
+
+
+def test_tox_testenv_create(newmocksession):
+    l = []
+
+    class Plugin:
+        @hookimpl
+        def tox_testenv_create(self, action, venv):
+            l.append(1)
+
+        @hookimpl
+        def tox_testenv_install_deps(self, action, venv):
+            l.append(2)
+
+    mocksession = newmocksession([], """
+        [testenv]
+        commands=testenv_fail
+        ignore_outcome=True
+    """, plugins=[Plugin()])
+
+    venv = mocksession.getenv('python')
+    venv.update(action=mocksession.newaction(venv, "getenv"))
+    assert l == [1, 2]

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tox/_pytestplugin.py
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -31,7 +31,7 @@
 
 @pytest.fixture
 def newconfig(request, tmpdir):
-    def newconfig(args, source=None):
+    def newconfig(args, source=None, plugins=()):
         if source is None:
             source = args
             args = []
@@ -40,7 +40,7 @@
         p.write(s)
         old = tmpdir.chdir()
         try:
-            return parseconfig(args)
+            return parseconfig(args, plugins=plugins)
         finally:
             old.chdir()
     return newconfig
@@ -168,9 +168,8 @@
     mocksession = request.getfuncargvalue("mocksession")
     newconfig = request.getfuncargvalue("newconfig")
 
-    def newmocksession(args, source):
-        config = newconfig(args, source)
-        mocksession.config = config
+    def newmocksession(args, source, plugins=()):
+        mocksession.config = newconfig(args, source, plugins=plugins)
         return mocksession
     return newmocksession
 

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tox/config.py
--- a/tox/config.py
+++ b/tox/config.py
@@ -29,13 +29,17 @@
 _dummy = object()
 
 
-def get_plugin_manager():
+def get_plugin_manager(plugins=()):
     # initialize plugin manager
+    import tox.venv
     pm = pluggy.PluginManager("tox")
     pm.add_hookspecs(hookspecs)
     pm.register(tox.config)
     pm.register(tox.interpreters)
+    pm.register(tox.venv)
     pm.load_setuptools_entrypoints("tox")
+    for plugin in plugins:
+        pm.register(plugin)
     pm.check_pending()
     return pm
 
@@ -186,7 +190,7 @@
         return value
 
 
-def parseconfig(args=None):
+def parseconfig(args=None, plugins=()):
     """
     :param list[str] args: Optional list of arguments.
     :type pkg: str
@@ -194,7 +198,7 @@
     :raise SystemExit: toxinit file is not found
     """
 
-    pm = get_plugin_manager()
+    pm = get_plugin_manager(plugins)
 
     if args is None:
         args = sys.argv[1:]

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tox/hookspecs.py
--- a/tox/hookspecs.py
+++ b/tox/hookspecs.py
@@ -30,3 +30,14 @@
     per-testenv configuration, notably the ``.envname`` and ``.basepython``
     setting.
     """
+
+
+ at hookspec
+def tox_testenv_create(venv, action):
+    """ [experimental] perform creation action for this venv.
+    """
+
+
+ at hookspec
+def tox_testenv_install_deps(venv, action):
+    """ [experimental] perform install dependencies action for this venv.  """

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tox/session.py
--- a/tox/session.py
+++ b/tox/session.py
@@ -313,6 +313,8 @@
 
 
 class Session:
+    """ (unstable API).  the session object that ties
+    together configuration, reporting, venv creation, testing. """
 
     def __init__(self, config, popen=subprocess.Popen, Report=Reporter):
         self.config = config

diff -r 0823f359a05bde1d8f12f02e98b6b3a26d83c2b2 -r ba0ff401e0374506e64ca0edaf663eea226955df tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -5,7 +5,7 @@
 import codecs
 import py
 import tox
-from .config import DepConfig
+from .config import DepConfig, hookimpl
 
 
 class CreationConfig:
@@ -58,6 +58,10 @@
         self.session = session
 
     @property
+    def hook(self):
+        return self.envconfig.config.pluginmanager.hook
+
+    @property
     def path(self):
         """ Path to environment base dir. """
         return self.envconfig.envdir
@@ -76,7 +80,8 @@
 
     def getcommandpath(self, name, venv=True, cwd=None):
         """ return absolute path (str or localpath) for specified
-        command name.  If venv is True we will check if the
+        command name.  If it's a localpath we will rewrite it as
+        as a relative path.  If venv is True we will check if the
         command is coming from the venv or is whitelisted to come
         from external. """
         name = str(name)
@@ -138,13 +143,14 @@
         else:
             action.setactivity("recreate", self.envconfig.envdir)
         try:
-            self.create(action)
+            self.hook.tox_testenv_create(action=action, venv=self)
+            self.just_created = True
         except tox.exception.UnsupportedInterpreter:
             return sys.exc_info()[1]
         except tox.exception.InterpreterNotFound:
             return sys.exc_info()[1]
         try:
-            self.install_deps(action)
+            self.hook.tox_testenv_install_deps(action=action, venv=self)
         except tox.exception.InvocationError:
             v = sys.exc_info()[1]
             return "could not install deps %s; v = %r" % (
@@ -180,28 +186,6 @@
     def matching_platform(self):
         return re.match(self.envconfig.platform, sys.platform)
 
-    def create(self, action):
-        # if self.getcommandpath("activate").dirpath().check():
-        #    return
-        config_interpreter = self.getsupportedinterpreter()
-        args = [sys.executable, '-m', 'virtualenv']
-        if self.envconfig.sitepackages:
-            args.append('--system-site-packages')
-        # add interpreter explicitly, to prevent using
-        # default (virtualenv.ini)
-        args.extend(['--python', str(config_interpreter)])
-        # if sys.platform == "win32":
-        #    f, path, _ = py.std.imp.find_module("virtualenv")
-        #    f.close()
-        #    args[:1] = [str(config_interpreter), str(path)]
-        # else:
-        self.session.make_emptydir(self.path)
-        basepath = self.path.dirpath()
-        basepath.ensure(dir=1)
-        args.append(self.path.basename)
-        self._pcall(args, venv=False, action=action, cwd=basepath)
-        self.just_created = True
-
     def finish(self):
         self._getliveconfig().writeconfig(self.path_config)
 
@@ -244,13 +228,6 @@
             extraopts = ['-U', '--no-deps']
         self._install([sdistpath], extraopts=extraopts, action=action)
 
-    def install_deps(self, action):
-        deps = self._getresolvedeps()
-        if deps:
-            depinfo = ", ".join(map(str, deps))
-            action.setactivity("installdeps", "%s" % depinfo)
-            self._install(deps, action=action)
-
     def _installopts(self, indexserver):
         l = []
         if indexserver:
@@ -390,3 +367,35 @@
     if not path.check(file=1):
         return "0" * 32
     return path.computehash()
+
+
+ at hookimpl
+def tox_testenv_create(venv, action):
+    # if self.getcommandpath("activate").dirpath().check():
+    #    return
+    config_interpreter = venv.getsupportedinterpreter()
+    args = [sys.executable, '-m', 'virtualenv']
+    if venv.envconfig.sitepackages:
+        args.append('--system-site-packages')
+    # add interpreter explicitly, to prevent using
+    # default (virtualenv.ini)
+    args.extend(['--python', str(config_interpreter)])
+    # if sys.platform == "win32":
+    #    f, path, _ = py.std.imp.find_module("virtualenv")
+    #    f.close()
+    #    args[:1] = [str(config_interpreter), str(path)]
+    # else:
+    venv.session.make_emptydir(venv.path)
+    basepath = venv.path.dirpath()
+    basepath.ensure(dir=1)
+    args.append(venv.path.basename)
+    venv._pcall(args, venv=False, action=action, cwd=basepath)
+
+
+ at hookimpl
+def tox_testenv_install_deps(venv, action):
+    deps = venv._getresolvedeps()
+    if deps:
+        depinfo = ", ".join(map(str, deps))
+        action.setactivity("installdeps", "%s" % depinfo)
+        venv._install(deps, action=action)


https://bitbucket.org/hpk42/tox/commits/4a8b2093838f/
Changeset:   4a8b2093838f
User:        hpk42
Date:        2015-12-09 12:24:10+00:00
Summary:     deprecate indexserver options
Affected #:  2 files

diff -r ba0ff401e0374506e64ca0edaf663eea226955df -r 4a8b2093838fdaeea640a49be9b3df87190b4fdc CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 2.3.0 (unreleased)
 -----
 
+- DEPRECATE use of "indexservers" in tox.ini.  It complicates
+  the internal code and it is recommended to rather use the
+  devpi system for managing indexes for pip.
+
 - fix issue285: make setenv processing fully lazy to fix regressions
   of tox-2.2.X and so that we can now have testenv attributes like 
   "basepython" depend on environment variables that are set in 
@@ -20,8 +24,8 @@
   tox_testenv_install_deps(venv, action) hooks to allow
   plugins to do additional work on creation or installing
   deps.  These hooks are experimental mainly because of
-  the involved "venv" object whose current public API is not 
-  fully guranteed.
+  the involved "venv" and session objects whose current public 
+  API is not fully guranteed.
 
 - internal: push some optional object creation into tests because
   tox core doesn't need it.

diff -r ba0ff401e0374506e64ca0edaf663eea226955df -r 4a8b2093838fdaeea640a49be9b3df87190b4fdc doc/config.txt
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -93,9 +93,6 @@
 
     .. versionadded:: 1.6
 
-    **WARNING**: This setting is **EXPERIMENTAL** so use with care
-    and be ready to adapt your tox.ini's with post-1.6 tox releases.
-
     the ``install_command`` setting is used for installing packages into
     the virtual environment; both the package under test
     and any defined dependencies. Must contain the substitution key
@@ -166,7 +163,8 @@
     package installation.  Each line defines a dependency, which will be
     passed to the installer command for processing.  Each line specifies a file,
     a URL or a package name.  You can additionally specify
-    an :confval:`indexserver` to use for installing this dependency.
+    an :confval:`indexserver` to use for installing this dependency
+    but this functionality is deprecated since tox-2.3.
     All derived dependencies (deps required by the dep) will then be
     retrieved from the specified indexserver::
 
@@ -259,8 +257,9 @@
 
    .. versionadded:: 0.9
 
-   Multi-line ``name = URL`` definitions of python package servers.
-   Dependencies can specify using a specified index server through the
+   (DEPRECATED, will be removed in a future version) Multi-line ``name =
+   URL`` definitions of python package servers.  Dependencies can
+   specify using a specified index server through the
    ``:indexservername:depname`` pattern.  The ``default`` indexserver
    definition determines where unscoped dependencies and the sdist install
    installs from.  Example::

Repository URL: https://bitbucket.org/hpk42/tox/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list