summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-08-15 13:00:38 +0200
committerholger krekel <holger@merlinux.eu>2013-08-15 13:00:38 +0200
commitb4a36312b945623667a8c156e8f8b0ef7561edf2 (patch)
tree54018b20155b871c32f8a6362358035352fb855d
parent4b82018b3ed3008a5a00787ece4697fc5ab477fa (diff)
downloadtox-b4a36312b945623667a8c156e8f8b0ef7561edf2.tar.gz
refine python2.5 and install_command behaviour and documentation. also show i in "--showconfig"
and rename internally from "install_command_argv" to install_command for consistency. also deprecate downloadcache, distribute settings.
-rwxr-xr-xCHANGELOG15
-rw-r--r--doc/config.txt46
-rw-r--r--tests/test_config.py28
-rw-r--r--tests/test_z_cmdline.py26
-rw-r--r--tox.ini4
-rw-r--r--tox/_cmdline.py2
-rw-r--r--tox/_config.py21
-rw-r--r--tox/_venv.py2
8 files changed, 92 insertions, 52 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c1af7ad..3acaf89 100755
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,17 @@
1.6.0.dev
-----------------
+- fix issue35: add new EXPERIMENTAL "install_command" testenv-option to configure the
+ installation command with options for dep/pkg install. Thanks Carl Meyer
+ for the PR and docs.
+
+
+- address issueintroduce python2.5 support by vendoring the virtualenv-1.9.1 script
+ and forcing pip<1.4. Also the default [py25] environment modifies the
+ default installer_command (new config option) to use pip without the "--pre"
+ which was introduced with pip-1.4 and is required if you want to install non-stable releases.
+ (tox defaults to install with "--pre" otherwise).
+
- fix issue1: empty setup files are properly detected, thanks Anthon van
der Neuth
@@ -11,10 +22,6 @@
- remove toxbootstrap.py for now because it is broken.
-- fix issue35: add new "install_command" testenv-option to configure the
- installation command with options for dep/pkg install. Thanks Carl Meyer
- for the PR and docs.
-
- fix issue109 and fix issue111: multiple "-e" options are now combined
(previously the last one would win). Thanks Anthon van der Neut.
diff --git a/doc/config.txt b/doc/config.txt
index 9b4dc5f..449f2a0 100644
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -80,9 +80,12 @@ Complete list of settings that you can put into ``testenv*`` sections:
.. versionadded:: 1.6
- the command to be used for installing packages into the virtual
- environment; both the sdist for the package under test and any
- defined dependencies. Must contain the substitution key
+ **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
``{packages}`` which will be replaced by the packages to
install. May also contain the substitution key ``{opts}``, which
will be replaced by the ``-i`` option to specify index server
@@ -94,7 +97,16 @@ Complete list of settings that you can put into ``testenv*`` sections:
:confval:`downloadcache`, and/or your :confval:`install_command`
should not include the ``{opts}`` substitution key (in which case
those options will have no effect).
- **default**: ``pip install {opts} {packages}``
+ **default**::
+
+ pip install --pre {opts} {packages}
+
+ **default on environment names containing 'py25'**::
+
+ pip install --insecure {opts} {packages}``
+
+ (this will use pip<1.4 (so no "--pre" option) and
+ python2.5 typically has no SSL support).
.. confval:: whitelist_externals=MULTI-LINE-LIST
@@ -137,37 +149,41 @@ Complete list of settings that you can put into ``testenv*`` sections:
.. confval:: downloadcache=path
+ **DEPRECATED** -- as of August 2013 this option is not very
+ useful because of pypi's CDN and because of caching pypi
+ server solutions like `devpi <http://doc.devpi.net>`_.
+
use this directory for caching downloads. This value is overriden
by the environment variable ``PIP_DOWNLOAD_CACHE`` if it exists. If
you specify a custom :confval:`install_command` that uses an
installer other than pip, your installer must support the
`--download-cache` command-line option.
**default**: no download cache will be used.
- **note**: if creating multiple environments use of a download cache greatly
- speeds up the testing process.
.. confval:: distribute=True|False
- Set to ``True`` if you want to use distribute_ instead of the default
- setuptools_ in the virtual environment. Prior to tox-1.5 the
- default was True and now is False, meaning ``setuptools`` is used
- (note that setuptools-0.7 merged with distribute). In future versions
- of tox this option might be ignored and setuptools always chosen.
+ **DEPRECATED** -- as of August 2013 you should use setuptools
+ which has merged most of distribute_ 's changes. Just use
+ the default, Luke! In future versions of tox this option might
+ be ignored and setuptools always chosen.
+
**default:** False.
.. confval:: sitepackages=True|False
Set to ``True`` if you want to create virtual environments that also
- have access to globally installed packages. **default:** False, meaning
- that virtualenvs will be created with ``--no-site-packages`` by default.
+ have access to globally installed packages.
+
+ **default:** False, meaning that virtualenvs will be
+ created without inheriting the global site packages.
.. confval:: args_are_paths=BOOL
treat positional arguments passed to ``tox`` as file system paths
and - if they exist on the filesystem - rewrite them according
to the ``changedir``.
- **default**: True (due to the exists-on-filesystem check it's usually
- safe to try rewriting).
+ **default**: True (due to the exists-on-filesystem check it's
+ usually safe to try rewriting).
.. confval:: envtmpdir=path
diff --git a/tests/test_config.py b/tests/test_config.py
index 344a8b0..e04a214 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -473,14 +473,28 @@ class TestConfigTestEnv:
assert envconfig.changedir.basename == "abc"
assert envconfig.changedir == config.setupdir.join("abc")
- def test_install_command(self, newconfig):
+ def test_install_command_defaults_py25(self, newconfig):
+ config = newconfig("""
+ [testenv:py25]
+ [testenv:py25-x]
+ [testenv:py26]
+ """)
+ for name in ("py25", "py25-x"):
+ env = config.envconfigs[name]
+ assert env.install_command == \
+ "pip install --insecure {opts} {packages}".split()
+ env = config.envconfigs["py26"]
+ assert env.install_command == \
+ "pip install --pre {opts} {packages}".split()
+
+ def test_install_command_setting(self, newconfig):
config = newconfig("""
[testenv]
- install_command=pip install --pre {packages}
+ install_command=some_install {packages}
""")
envconfig = config.envconfigs['python']
- assert envconfig.install_command_argv == [
- 'pip', 'install', '--pre', '{packages}']
+ assert envconfig.install_command == [
+ 'some_install', '{packages}']
def test_install_command_must_contain_packages(self, newconfig):
py.test.raises(tox.exception.ConfigError, newconfig, """
@@ -506,7 +520,8 @@ class TestConfigTestEnv:
envconfig = config.envconfigs['python']
assert envconfig.downloadcache == '/from/env'
- def test_downloadcache_only_if_in_config(self, newconfig, tmpdir, monkeypatch):
+ def test_downloadcache_only_if_in_config(self, newconfig, tmpdir,
+ monkeypatch):
monkeypatch.setenv("PIP_DOWNLOAD_CACHE", tmpdir)
config = newconfig('')
envconfig = config.envconfigs['python']
@@ -744,7 +759,8 @@ class TestGlobalOptions:
config = newconfig(["-vv"], "")
assert config.option.verbosity == 2
- def test_substitution_jenkins_default(self, tmpdir, monkeypatch, newconfig):
+ def test_substitution_jenkins_default(self, tmpdir,
+ monkeypatch, newconfig):
monkeypatch.setenv("HUDSON_URL", "xyz")
config = newconfig("""
[testenv:py24]
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 6d11dc0..e9735ac 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -10,11 +10,6 @@ except ImportError:
pytest_plugins = "pytester"
-if sys.version_info < (2,6):
- PIP_INSECURE = "setenv = PIP_INSECURE=1"
-else:
- PIP_INSECURE = ""
-
from tox._cmdline import Session
from tox._config import parseconfig
@@ -379,10 +374,10 @@ class TestToxRun:
'tox.ini': '''
[testenv]
changedir=tests
- %s
- commands= py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml
+ commands= py.test --basetemp={envtmpdir} \
+ --junitxml=junit-{envname}.xml
deps=pytest
- ''' % PIP_INSECURE
+ '''
})
def test_toxuone_env(self, cmd, example123):
@@ -473,11 +468,10 @@ def test_test_usedevelop(cmd, initproj):
[testenv]
usedevelop=True
changedir=tests
- %s
commands=
py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml []
deps=pytest
- ''' % PIP_INSECURE
+ '''
})
result = cmd.run("tox", "-v")
assert not result.ret
@@ -521,10 +515,10 @@ def test_test_piphelp(initproj, cmd):
# content of: tox.ini
[testenv]
commands=pip -h
- [testenv:py25]
- basepython=python
[testenv:py26]
basepython=python
+ [testenv:py27]
+ basepython=python
"""})
result = cmd.run("tox")
assert not result.ret
@@ -532,19 +526,19 @@ def test_test_piphelp(initproj, cmd):
def test_notest(initproj, cmd):
initproj("example123", filedefs={'tox.ini': """
# content of: tox.ini
- [testenv:py25]
+ [testenv:py26]
basepython=python
"""})
result = cmd.run("tox", "-v", "--notest")
assert not result.ret
result.stdout.fnmatch_lines([
"*summary*",
- "*py25*skipped tests*",
+ "*py26*skipped tests*",
])
- result = cmd.run("tox", "-v", "--notest", "-epy25")
+ result = cmd.run("tox", "-v", "--notest", "-epy26")
assert not result.ret
result.stdout.fnmatch_lines([
- "*py25*reusing*",
+ "*py26*reusing*",
])
def test_PYC(initproj, cmd, monkeypatch):
diff --git a/tox.ini b/tox.ini
index f3bf38d..1b9417c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,10 +8,6 @@ commands=echo {posargs}
commands=py.test --junitxml={envlogdir}/junit-{envname}.xml {posargs}
deps=pytest>=2.3.5
-[testenv:py25] # requires virtualenv-1.9.1
-setenvs =
- PIP_INSECURE=True
-
[testenv:docs]
basepython=python
changedir=doc
diff --git a/tox/_cmdline.py b/tox/_cmdline.py
index 766e42b..d6ee996 100644
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -492,6 +492,8 @@ class Session:
self.report.line(" envlogdir=%s" % envconfig.envlogdir)
self.report.line(" changedir=%s" % envconfig.changedir)
self.report.line(" args_are_path=%s" % envconfig.args_are_paths)
+ self.report.line(" install_command=%s" %
+ envconfig.install_command)
self.report.line(" commands=")
for command in envconfig.commands:
self.report.line(" %s" % command)
diff --git a/tox/_config.py b/tox/_config.py
index a07fd9a..a12a19e 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -76,8 +76,8 @@ def prepare_parse(pkgname):
parser.add_argument("-v", nargs=0, action=CountAction, default=0,
dest="verbosity",
help="increase verbosity of reporting output.")
- parser.add_argument("--showconfig", action="store_true", dest="showconfig",
- help="show configuration information. ")
+ parser.add_argument("--showconfig", action="store_true",
+ help="show configuration information for all environments. ")
parser.add_argument("-l", "--listenvs", action="store_true",
dest="listenvs", help="show list of test environments")
parser.add_argument("-c", action="store", default="tox.ini",
@@ -331,15 +331,24 @@ class parseini:
# env var, if present, takes precedence
downloadcache = os.environ.get("PIP_DOWNLOAD_CACHE", downloadcache)
vc.downloadcache = py.path.local(downloadcache)
- vc.install_command_argv = reader.getargv(
+
+ # on python 2.5 we can't use "--pre" and we typically
+ # need to use --insecure for pip commands because python2.5
+ # doesn't support SSL
+ pip_default_opts = ["{opts}", "{packages}"]
+ if "py25" in vc.envname: # XXX too rough check for "python2.5"
+ pip_default_opts.insert(0, "--insecure")
+ else:
+ pip_default_opts.insert(0, "--pre")
+ vc.install_command = reader.getargv(
section,
"install_command",
- "pip install {opts} {packages}",
+ "pip install " + " ".join(pip_default_opts),
replace=False,
)
- if '{packages}' not in vc.install_command_argv:
+ if '{packages}' not in vc.install_command:
raise tox.exception.ConfigError(
- "'install_command' must contain '{packages}' substitution")
+ "'install_command' must contain '{packages}' substitution")
return vc
def _getenvlist(self, reader, toxsection):
diff --git a/tox/_venv.py b/tox/_venv.py
index b8f2daf..8b451ff 100644
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -285,7 +285,7 @@ class VirtualEnv(object):
def run_install_command(self, args, indexserver=None, action=None,
extraenv=None):
- argv = self.envconfig.install_command_argv[:]
+ argv = self.envconfig.install_command[:]
# use pip-script on win32 to avoid the executable locking
if argv[0] == "pip" and sys.platform == "win32":
argv[0] = "pip-script.py"