[Pytest-commit] commit/tox: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Mar 20 14:14:16 CET 2015
2 new commits in tox:
https://bitbucket.org/hpk42/tox/commits/89eda908cc6a/
Changeset: 89eda908cc6a
Branch: complex-projname-initproj
User: fschulze
Date: 2015-03-20 12:06:32+00:00
Summary: Enhanced initproj fixture to accept a tuple for name/version specifier.
This allows projects with dashes in their name. This fixture is used in devpi where this functionality is needed.
Affected #: 2 files
diff -r aa5b7ce560ca7cc27ed609fad8d2678a9e6836ac -r 89eda908cc6a6ef0fc1dba67611a5a6e198f9821 tests/test_z_cmdline.py
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -598,7 +598,7 @@
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 @@
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 -r aa5b7ce560ca7cc27ed609fad8d2678a9e6836ac -r 89eda908cc6a6ef0fc1dba67611a5a6e198f9821 tox/_pytestplugin.py
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -2,7 +2,7 @@
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 @@
@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:
https://bitbucket.org/hpk42/tox/commits/ce2979a973dc/
Changeset: ce2979a973dc
User: hpk42
Date: 2015-03-20 13:14:12+00:00
Summary: Merged in fschulze/tox/complex-projname-initproj (pull request #137)
Enhanced initproj fixture to accept a tuple for name/version specifier.
Affected #: 2 files
diff -r aa5b7ce560ca7cc27ed609fad8d2678a9e6836ac -r ce2979a973dc98ca803825a01d1a83b1b8cb5984 tests/test_z_cmdline.py
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -598,7 +598,7 @@
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 @@
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 -r aa5b7ce560ca7cc27ed609fad8d2678a9e6836ac -r ce2979a973dc98ca803825a01d1a83b1b8cb5984 tox/_pytestplugin.py
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -2,7 +2,7 @@
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 @@
@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:
Repository URL: https://bitbucket.org/hpk42/tox/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list