Commits

holger krekel committed b104bfa

command line option --extradeps=dep1,dep2,... to specify extra deps
which are to be applied in each test environment.

Comments (0)

Files changed (7)

 1.4.3.dev
 -----------------
 
-- experimentally introduce --installpkg=PATH option to install a package rather than
-  create/install an sdist package.  This will still require and use
-  tox.ini and tests from the current working dir (and not from the remote
-  package).
+- add --extradeps option to install extra dependencies in all testenvs
+
+- experimentally introduce --installpkg=PATH option to install a package
+  rather than create/install an sdist package.  This will still require
+  and use tox.ini and tests from the current working dir (and not from the
+  remote package).
 
 - substitute {envsitepackagesdir} with the package installation directory (closes #72)
   (thanks g2p)
         description='virtualenv-based automation of test activities',
         long_description=long_description,
         url='http://tox.testrun.org/',
-        version='1.4.3.dev5',
+        version='1.4.3.dev6',
         license='GPLv2 or later',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
         author='holger krekel',

tests/test_config.py

         assert envconfig.envlogdir == envconfig.envdir.join("log")
         assert envconfig.setenv is None
 
+    def test_extradeps(self, tmpdir, newconfig):
+        config = newconfig(["--extradeps=dep1,dep2"], """
+            [testenv]
+            deps = abc
+
+            [testenv:hello1]
+            [testenv:hello2]
+            deps = cde
+        """)
+        assert config.envconfigs["hello1"].deps[0].name == "abc"
+        assert config.envconfigs["hello1"].deps[1].name == "dep1"
+        assert config.envconfigs["hello1"].deps[2].name == "dep2"
+        assert config.envconfigs["hello2"].deps[0].name == "cde"
+        assert config.envconfigs["hello2"].deps[1].name == "dep1"
+        assert config.envconfigs["hello2"].deps[2].name == "dep2"
+
     def test_specific_command_overrides(self, tmpdir, newconfig):
         config = newconfig("""
             [testenv]
 #
-__version__ = '1.4.3.dev5'
+__version__ = '1.4.3.dev6'
 
 class exception:
     class Error(Exception):
     parser.add_argument("-r", "--recreate", action="store_true",
         dest="recreate",
         help="force recreation of virtual environments")
+    parser.add_argument("--extradeps", action="store", default="",
+        help="comma-separated list of global extra dependencies")
     parser.add_argument("args", nargs="*",
         help="additional arguments available to command positional substition")
     return parser
 
         vc.commands = reader.getargvlist(section, "commands")
         vc.deps = []
-        for depline in reader.getlist(section, "deps"):
+        deplines = reader.getlist(section, "deps")
+        deplines.extend(filter(None, config.option.extradeps.split(",")))
+        for depline in deplines:
             m = re.match(r":(\w+):\s*(\S+)", depline)
             if m:
                 iname, name = m.groups()

tox/_pytestplugin.py

         s = py.std.textwrap.dedent(source)
         p = tmpdir.join("tox.ini")
         p.write(s)
+        assert isinstance(args, list)
         old = tmpdir.chdir()
         try:
             return parseconfig(args)
 
 """
 
-__version__ = '1.4.3.dev5'
+__version__ = '1.4.3.dev6'
 
 import sys
 import os