diff options
author | holger krekel <holger@merlinux.eu> | 2015-03-20 14:14:12 +0100 |
---|---|---|
committer | holger krekel <holger@merlinux.eu> | 2015-03-20 14:14:12 +0100 |
commit | ee48e28fac01d1b813905b15aa1332ef5cba097e (patch) | |
tree | 699c3fa515cdbf1957124d75d68edd7c5168e99f | |
parent | 6ff5133b63a7fe369f8f023dfde652fbf3d3c9ad (diff) | |
parent | 3ae24384c585cf3581394217961d4872ab0ce88b (diff) | |
download | tox-ee48e28fac01d1b813905b15aa1332ef5cba097e.tar.gz |
Merged in fschulze/tox/complex-projname-initproj (pull request #137)
Enhanced initproj fixture to accept a tuple for name/version specifier.
-rw-r--r-- | tests/test_z_cmdline.py | 4 | ||||
-rw-r--r-- | tox/_pytestplugin.py | 15 |
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: |