summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py2
-rw-r--r--tests/test_venv.py22
-rw-r--r--tests/test_z_cmdline.py19
-rw-r--r--tox.ini2
-rw-r--r--tox/_cmdline.py8
-rw-r--r--tox/_venv.py17
-rw-r--r--tox/vendor/__init__.py1
-rwxr-xr-x[-rw-r--r--]tox/vendor/virtualenv.py (renamed from tox/virtualenv-1.9.1.py)0
8 files changed, 48 insertions, 23 deletions
diff --git a/setup.py b/setup.py
index f286a4f..7894e3a 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ def main():
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='holger krekel',
author_email='holger@merlinux.eu',
- packages=['tox', ],
+ packages=['tox', 'tox.vendor'],
entry_points={'console_scripts': 'tox=tox:cmdline\ntox-quickstart=tox._quickstart:main'},
# we use a public tox version to test, see tox.ini's testenv
# "deps" definition for the required dependencies
diff --git a/tests/test_venv.py b/tests/test_venv.py
index b27b8a9..aed5487 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -6,6 +6,8 @@ from tox._venv import VirtualEnv, CreationConfig, getdigest
from tox._venv import find_executable
from tox._venv import _getinterpreterversion
+py25calls = int(sys.version_info[:2] == (2,5))
+
#def test_global_virtualenv(capfd):
# v = VirtualEnv()
# l = v.list()
@@ -98,7 +100,7 @@ def test_create(monkeypatch, mocksession, newconfig):
l = mocksession._pcalls
assert len(l) >= 1
args = l[0].args
- assert str(args[1]).endswith("virtualenv.py")
+ assert "virtualenv" in str(args[1])
if sys.platform != "win32":
# realpath is needed for stuff like the debian symlinks
assert py.path.local(sys.executable).realpath() == args[0]
@@ -173,15 +175,15 @@ def test_install_deps_wildcard(newmocksession):
venv = mocksession.getenv("py123")
venv.create()
l = mocksession._pcalls
- assert len(l) == 1
+ assert len(l) == 1 + py25calls
distshare = venv.session.config.distshare
distshare.ensure("dep1-1.0.zip")
distshare.ensure("dep1-1.1.zip")
venv.install_deps()
- assert len(l) == 2
- args = l[1].args
- assert l[1].cwd == venv.envconfig.envlogdir
+ assert len(l) == 2 + py25calls
+ args = l[-1].args
+ assert l[-1].cwd == venv.envconfig.envlogdir
assert "pip" in str(args[0])
assert args[1] == "install"
#arg = "--download-cache=" + str(venv.envconfig.downloadcache)
@@ -206,12 +208,12 @@ def test_install_downloadcache(newmocksession, monkeypatch, tmpdir, envdc):
venv = mocksession.getenv("py123")
venv.create()
l = mocksession._pcalls
- assert len(l) == 1
+ assert len(l) == 1 + py25calls
venv.install_deps()
- assert len(l) == 2
- args = l[1].args
- assert l[1].cwd == venv.envconfig.envlogdir
+ assert len(l) == 2 + py25calls
+ args = l[-1].args
+ assert l[-1].cwd == venv.envconfig.envlogdir
assert "pip" in str(args[0])
assert args[1] == "install"
assert "dep1" in args
@@ -234,7 +236,7 @@ def test_install_deps_indexserver(newmocksession):
venv = mocksession.getenv('py123')
venv.create()
l = mocksession._pcalls
- assert len(l) == 1
+ assert len(l) == 1 + py25calls
l[:] = []
venv.install_deps()
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index d7f99b6..6d11dc0 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -3,9 +3,18 @@ import py
import pytest
import sys
from tox._pytestplugin import ReportExpectMock
+try:
+ import json
+except ImportError:
+ import simplejson as json
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
@@ -356,6 +365,8 @@ def test_package_install_fails(cmd, initproj):
"*InvocationError*",
])
+
+
class TestToxRun:
@pytest.fixture
def example123(self, initproj):
@@ -368,9 +379,10 @@ class TestToxRun:
'tox.ini': '''
[testenv]
changedir=tests
+ %s
commands= py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml
deps=pytest
- '''
+ ''' % PIP_INSECURE
})
def test_toxuone_env(self, cmd, example123):
@@ -407,7 +419,7 @@ class TestToxRun:
jsonpath = cmd.tmpdir.join("res.json")
result = cmd.run("tox", "--result-json", jsonpath)
assert result.ret == 1
- data = py.std.json.load(jsonpath.open("r"))
+ data = json.load(jsonpath.open("r"))
verify_json_report_format(data)
result.stdout.fnmatch_lines([
"*1 failed*",
@@ -461,10 +473,11 @@ 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
diff --git a/tox.ini b/tox.ini
index 8e91eca..f3bf38d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist=py27,py26,py32,py33,pypy
+envlist=py25,py27,py26,py32,py33,pypy
[testenv:X]
commands=echo {posargs}
diff --git a/tox/_cmdline.py b/tox/_cmdline.py
index 42a3f80..766e42b 100644
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -506,8 +506,12 @@ class Session:
def info_versions(self):
versions = ['tox-%s' % tox.__version__]
- version = py.process.cmdexec("virtualenv --version")
- versions.append("virtualenv-%s" % version.strip())
+ try:
+ version = py.process.cmdexec("virtualenv --version")
+ except py.process.cmdexec.Error:
+ versions.append("virtualenv-1.9.1 (vendored)")
+ else:
+ versions.append("virtualenv-%s" % version.strip())
self.report.keyvalue("tool-versions:", " ".join(versions))
diff --git a/tox/_venv.py b/tox/_venv.py
index 0ce70c4..b43138a 100644
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -181,7 +181,8 @@ class VirtualEnv(object):
if action is None:
action = self.session.newaction(self, "create")
config_interpreter = self.getsupportedinterpreter()
- config_interpreter_version = _getinterpreterversion(config_interpreter)
+ config_interpreter_version = _getinterpreterversion(
+ config_interpreter)
use_venv191 = config_interpreter_version < '2.6'
use_pip13 = config_interpreter_version < '2.6'
if not use_venv191:
@@ -189,15 +190,17 @@ class VirtualEnv(object):
f.close()
venvscript = path.rstrip("co")
else:
- venvscript = py.path.local(tox.__file__).dirpath("virtualenv-1.9.1.py")
- args = [config_interpreter, venvscript]
+ venvscript = py.path.local(tox.__file__).dirpath(
+ "vendor", "virtualenv.py")
+ args = [config_interpreter, str(venvscript)]
if self.envconfig.distribute:
args.append("--distribute")
else:
args.append("--setuptools")
if self.envconfig.sitepackages:
args.append('--system-site-packages')
- # add interpreter explicitly, to prevent using default (virtualenv.ini)
+ # 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")
@@ -214,8 +217,10 @@ class VirtualEnv(object):
indexserver = self.envconfig.config.indexserver['default'].url
action = self.session.newaction(self, "pip_downgrade")
action.setactivity('pip-downgrade', 'pip<1.4')
- argv = ["easy_install"] + self._commoninstallopts(indexserver) + ['pip<1.4']
- self._pcall(argv, cwd=self.envconfig.envlogdir, action=action)
+ argv = ["easy_install"] + \
+ self._installopts(indexserver) + ['pip<1.4']
+ self._pcall(argv, cwd=self.envconfig.envlogdir,
+ action=action)
def finish(self):
self._getliveconfig().writeconfig(self.path_config)
diff --git a/tox/vendor/__init__.py b/tox/vendor/__init__.py
new file mode 100644
index 0000000..792d600
--- /dev/null
+++ b/tox/vendor/__init__.py
@@ -0,0 +1 @@
+#
diff --git a/tox/virtualenv-1.9.1.py b/tox/vendor/virtualenv.py
index ccb6eec..ccb6eec 100644..100755
--- a/tox/virtualenv-1.9.1.py
+++ b/tox/vendor/virtualenv.py