summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG7
-rw-r--r--setup.py2
-rw-r--r--tests/test_venv.py23
-rw-r--r--tests/test_z_cmdline.py9
-rw-r--r--tox/__init__.py2
-rw-r--r--tox/session.py8
-rw-r--r--tox/venv.py20
7 files changed, 30 insertions, 41 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3ae702c..54ea8be 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
+2.1.1
+----------
+
+- fix platform skipping for detox
+
+- report skipped platforms as skips in the summary
+
2.1.0
----------
diff --git a/setup.py b/setup.py
index f82efb3..a72a5fc 100644
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def main():
description='virtualenv-based automation of test activities',
long_description=open("README.rst").read(),
url='http://tox.testrun.org/',
- version='2.1.0',
+ version='2.1.1',
license='http://opensource.org/licenses/MIT',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='holger krekel',
diff --git a/tests/test_venv.py b/tests/test_venv.py
index d2d2bf0..7c6b05a 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -473,31 +473,24 @@ class TestCreationConfig:
class TestVenvTest:
- def test_patchPATH(self, newmocksession, monkeypatch):
+ def test_envbinddir_path(self, newmocksession, monkeypatch):
monkeypatch.setenv("PIP_RESPECT_VIRTUALENV", "1")
mocksession = newmocksession([], """
[testenv:python]
commands=abc
""")
venv = mocksession.getenv("python")
- envconfig = venv.envconfig
monkeypatch.setenv("PATH", "xyz")
- oldpath = venv.patchPATH()
- assert oldpath == "xyz"
- res = os.environ['PATH']
- assert res == "%s%sxyz" % (envconfig.envbindir, os.pathsep)
- p = "xyz" + os.pathsep + str(envconfig.envbindir)
- monkeypatch.setenv("PATH", p)
- venv.patchPATH()
- res = os.environ['PATH']
- assert res == "%s%s%s" % (envconfig.envbindir, os.pathsep, p)
-
- assert envconfig.commands
- monkeypatch.setattr(venv, '_pcall', lambda *args, **kwargs: 0 / 0)
+ 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'))")
+ assert l.pop()["paths"] == [venv.envconfig.envbindir]
py.test.raises(ZeroDivisionError, "venv.test()")
+ assert l.pop()["paths"] == [venv.envconfig.envbindir]
py.test.raises(ZeroDivisionError, "venv.run_install_command(['qwe'])")
- py.test.raises(ZeroDivisionError, "venv._pcall([1,2,3])")
+ assert l.pop()["paths"] == [venv.envconfig.envbindir]
monkeypatch.setenv("PIP_RESPECT_VIRTUALENV", "1")
monkeypatch.setenv("PIP_REQUIRE_VIRTUALENV", "1")
monkeypatch.setenv("__PYVENV_LAUNCHER__", "1")
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 2461790..b288880 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -263,12 +263,9 @@ def test_skip_platform_mismatch(cmd, initproj):
})
result = cmd.run("tox")
assert not result.ret
- assert "platform mismatch" not in result.stdout.str()
- result = cmd.run("tox", "-v")
- assert not result.ret
- result.stdout.fnmatch_lines([
- "*python*platform mismatch*"
- ])
+ result.stdout.fnmatch_lines("""
+ SKIPPED*platform mismatch*
+ """)
def test_skip_unknown_interpreter(cmd, initproj):
diff --git a/tox/__init__.py b/tox/__init__.py
index 6c2cbe4..b2fed05 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -1,5 +1,5 @@
#
-__version__ = '2.1.0'
+__version__ = '2.1.1'
from .hookspecs import hookspec, hookimpl # noqa
diff --git a/tox/session.py b/tox/session.py
index b00465b..fcdcf6c 100644
--- a/tox/session.py
+++ b/tox/session.py
@@ -421,6 +421,9 @@ class Session:
path.ensure(dir=1)
def setupenv(self, venv):
+ if not venv.matching_platform():
+ venv.status = "platform mismatch"
+ return # we simply omit non-matching platforms
action = self.newaction(venv, "getenv", venv.envconfig.envdir)
with action:
venv.status = 0
@@ -518,9 +521,6 @@ class Session:
if self.config.option.sdistonly:
return
for venv in self.venvlist:
- if not venv.matching_platform():
- venv.status = "platform mismatch"
- continue # we simply omit non-matching platforms
if self.setupenv(venv):
if venv.envconfig.usedevelop:
self.developpkg(venv, self.config.setupdir)
@@ -569,7 +569,7 @@ class Session:
self.report.error(msg)
elif status == "platform mismatch":
msg = " %s: %s" % (venv.envconfig.envname, str(status))
- self.report.verbosity1(msg)
+ self.report.skip(msg)
elif status and status != "skipped tests":
msg = " %s: %s" % (venv.envconfig.envname, str(status))
self.report.error(msg)
diff --git a/tox/venv.py b/tox/venv.py
index 6a64951..7990330 100644
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -366,21 +366,13 @@ class VirtualEnv(object):
os.environ.pop(name, None)
cwd.ensure(dir=1)
- old = self.patchPATH()
- try:
- args[0] = self.getcommandpath(args[0], venv, cwd)
- env = self._getenv(testcommand=testcommand)
- return action.popen(args, cwd=cwd, env=env,
- redirect=redirect, ignore_ret=ignore_ret)
- finally:
- os.environ['PATH'] = old
-
- def patchPATH(self):
- oldPATH = os.environ['PATH']
+ args[0] = self.getcommandpath(args[0], venv, cwd)
+ env = self._getenv(testcommand=testcommand)
bindir = str(self.envconfig.envbindir)
- os.environ['PATH'] = os.pathsep.join([bindir, oldPATH])
- self.session.report.verbosity2("setting PATH=%s" % os.environ["PATH"])
- return oldPATH
+ env['PATH'] = p = os.pathsep.join([bindir, os.environ["PATH"]])
+ self.session.report.verbosity2("setting PATH=%s" % p)
+ return action.popen(args, cwd=cwd, env=env,
+ redirect=redirect, ignore_ret=ignore_ret)
def getdigest(path):