summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-02-01 00:19:59 +0100
committerholger krekel <holger@merlinux.eu>2013-02-01 00:19:59 +0100
commit3479e83714667a72144938c3b2ae6473b46cd295 (patch)
treefc3ec6d87e8e7c0b9cda1e3faf4b925e4a9a6643
parente8d8ae5c9f01992517e339f184f04373abac9fbc (diff)
downloadtox-3479e83714667a72144938c3b2ae6473b46cd295.tar.gz
command line option --extradeps=dep1,dep2,... to specify extra deps
which are to be applied in each test environment.
-rwxr-xr-xCHANGELOG10
-rw-r--r--setup.py2
-rw-r--r--tests/test_config.py16
-rw-r--r--tox/__init__.py2
-rw-r--r--tox/_config.py6
-rw-r--r--tox/_pytestplugin.py1
-rw-r--r--toxbootstrap.py2
7 files changed, 31 insertions, 8 deletions
diff --git a/CHANGELOG b/CHANGELOG
index d73a57b..525c1a4 100755
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,12 @@
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)
diff --git a/setup.py b/setup.py
index 49c2b54..bca2edf 100644
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,7 @@ def main():
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',
diff --git a/tests/test_config.py b/tests/test_config.py
index 9afa45b..15532be 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -332,6 +332,22 @@ class TestConfigTestEnv:
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]
diff --git a/tox/__init__.py b/tox/__init__.py
index b57d4d6..7c24641 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -1,5 +1,5 @@
#
-__version__ = '1.4.3.dev5'
+__version__ = '1.4.3.dev6'
class exception:
class Error(Exception):
diff --git a/tox/_config.py b/tox/_config.py
index 171e20b..d24d044 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -96,6 +96,8 @@ def prepare_parse(pkgname):
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
@@ -287,7 +289,9 @@ class parseini:
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()
diff --git a/tox/_pytestplugin.py b/tox/_pytestplugin.py
index 70fa48a..01c9033 100644
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -26,6 +26,7 @@ def pytest_funcarg__newconfig(request, tmpdir):
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)
diff --git a/toxbootstrap.py b/toxbootstrap.py
index c3fea7d..614817a 100644
--- a/toxbootstrap.py
+++ b/toxbootstrap.py
@@ -58,7 +58,7 @@ ToDo
"""
-__version__ = '1.4.3.dev5'
+__version__ = '1.4.3.dev6'
import sys
import os