summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2015-03-20 19:46:14 +0100
committerholger krekel <holger@merlinux.eu>2015-03-20 19:46:14 +0100
commitde704be1908adc408f93b72be6142acc4f0ca620 (patch)
tree26bac519622f59ce20e7dac4fb3127a01c04d094
parent02977e26fe94e1b3a2d206d872f5f8ca6759ca38 (diff)
parentee48e28fac01d1b813905b15aa1332ef5cba097e (diff)
downloadtox-de704be1908adc408f93b72be6142acc4f0ca620.tar.gz
Merged in fschulze/tox/file-instead-of-pipe (pull request #138)
Use a file instead of a pipe for command output in "--result-json".
-rw-r--r--tests/test_z_cmdline.py4
-rw-r--r--tox/_pytestplugin.py15
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 00188ac..0c145be 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -598,7 +598,7 @@ def test_sdistonly(initproj, cmd):
def test_separate_sdist_no_sdistfile(cmd, initproj):
distshare = cmd.tmpdir.join("distshare")
- initproj("pkg123-0.7", filedefs={
+ initproj(("pkg123-foo", "0.7"), filedefs={
'tox.ini': """
[tox]
distshare=%s
@@ -609,7 +609,7 @@ def test_separate_sdist_no_sdistfile(cmd, initproj):
l = distshare.listdir()
assert len(l) == 1
sdistfile = l[0]
- assert 'pkg123-0.7.zip' in str(sdistfile)
+ assert 'pkg123-foo-0.7.zip' in str(sdistfile)
def test_separate_sdist(cmd, initproj):
distshare = cmd.tmpdir.join("distshare")
diff --git a/tox/_pytestplugin.py b/tox/_pytestplugin.py
index 4f00d3f..ded13ec 100644
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -2,7 +2,7 @@ import pytest, py
import tox
import os
import sys
-from py.builtin import print_
+from py.builtin import _isbytes, _istext, print_
from fnmatch import fnmatch
import time
from tox._config import parseconfig
@@ -263,13 +263,16 @@ class LineMatcher:
@pytest.fixture
def initproj(request, tmpdir):
""" create a factory function for creating example projects. """
- def initproj(name, filedefs=None):
+ def initproj(nameversion, filedefs=None):
if filedefs is None:
filedefs = {}
- parts = name.split("-")
- if len(parts) == 1:
- parts.append("0.1")
- name, version = parts
+ if _istext(nameversion) or _isbytes(nameversion):
+ parts = nameversion.split("-")
+ if len(parts) == 1:
+ parts.append("0.1")
+ name, version = parts
+ else:
+ name, version = nameversion
base = tmpdir.ensure(name, dir=1)
create_files(base, filedefs)
if 'setup.py' not in filedefs: