some test fixes and configure tox-testing against pytest==2.3.5 and pytest>=2.4.2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
1.9.dev
|
||||
1.9
|
||||
-------------------------
|
||||
|
||||
- changed LICENSE to MIT
|
||||
|
||||
@@ -2,5 +2,6 @@ include CHANGELOG
|
||||
include LICENSE
|
||||
include README.txt
|
||||
include setup.py
|
||||
include tox.ini
|
||||
graft testing
|
||||
prune .hg
|
||||
|
||||
4
setup.py
4
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="pytest-xdist",
|
||||
version='1.9dev2',
|
||||
version='1.9',
|
||||
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
|
||||
long_description=open('README.txt').read(),
|
||||
license='MIT',
|
||||
@@ -13,7 +13,7 @@ setup(
|
||||
packages = ['xdist'],
|
||||
entry_points = {'pytest11': ['xdist = xdist.plugin'],},
|
||||
zip_safe=False,
|
||||
install_requires = ['execnet>=1.0.8', 'pytest>=2.2.1'],
|
||||
install_requires = ['execnet>=1.1', 'pytest>=2.3.5'],
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
|
||||
@@ -17,9 +17,16 @@ def run(item, node, excinfo=None):
|
||||
rep.node = node
|
||||
return rep
|
||||
|
||||
class MockGateway:
|
||||
_count = 0
|
||||
def __init__(self):
|
||||
self.id = str(self._count)
|
||||
self._count += 1
|
||||
|
||||
class MockNode:
|
||||
def __init__(self):
|
||||
self.sent = []
|
||||
self.gateway = MockGateway()
|
||||
|
||||
def send_runtest(self, nodeid):
|
||||
self.sent.append(nodeid)
|
||||
@@ -183,22 +190,22 @@ def test_report_collection_diff_different():
|
||||
from_collection = ['aaa', 'bbb', 'ccc', 'YYY']
|
||||
to_collection = ['aZa', 'bbb', 'XXX', 'ccc']
|
||||
error_message = (
|
||||
u'Different tests were collected between 1 and 2. The difference is:\n'
|
||||
u'--- 1 \n'
|
||||
u'\n'
|
||||
u'+++ 2 \n'
|
||||
u'\n'
|
||||
u'@@ -1,4 +1,4 @@\n'
|
||||
u'\n'
|
||||
u'-aaa\n'
|
||||
u'+aZa\n'
|
||||
u' bbb\n'
|
||||
u'+XXX\n'
|
||||
u' ccc\n'
|
||||
u'-YYY'
|
||||
'Different tests were collected between 1 and 2. The difference is:\n'
|
||||
'--- 1\n'
|
||||
'\n'
|
||||
'+++ 2\n'
|
||||
'\n'
|
||||
'@@ -1,4 +1,4 @@\n'
|
||||
'\n'
|
||||
'-aaa\n'
|
||||
'+aZa\n'
|
||||
' bbb\n'
|
||||
'+XXX\n'
|
||||
' ccc\n'
|
||||
'-YYY'
|
||||
)
|
||||
|
||||
try:
|
||||
report_collection_diff(from_collection, to_collection, 1, 2)
|
||||
except AssertionError as e:
|
||||
assert unicode(e) == error_message
|
||||
assert py.builtin._totext(e) == error_message
|
||||
|
||||
16
tox.ini
16
tox.ini
@@ -1,16 +1,26 @@
|
||||
[tox]
|
||||
envlist=py26,py32,py33,py27,py25
|
||||
envlist=py26,py32,py33,py27,py26,py26-old,py33-old
|
||||
|
||||
[testenv]
|
||||
changedir=testing
|
||||
deps=pytest>=2.3.5
|
||||
deps=pytest>=2.4.2
|
||||
commands= py.test --junitxml={envlogdir}/junit-{envname}.xml []
|
||||
|
||||
[testenv:py27]
|
||||
deps=
|
||||
pytest
|
||||
pytest>=2.4.2
|
||||
pexpect
|
||||
|
||||
[testenv:py26-old]
|
||||
deps=
|
||||
pytest==2.3.5
|
||||
pexpect
|
||||
|
||||
[testenv:py33-old]
|
||||
basepython = python3.3
|
||||
deps=
|
||||
pytest==2.3.5
|
||||
|
||||
[pytest]
|
||||
addopts = -rsfxX
|
||||
;; hello
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#
|
||||
__version__ = '1.9dev2'
|
||||
__version__ = '1.9'
|
||||
|
||||
@@ -177,13 +177,13 @@ def report_collection_diff(from_collection, to_collection, from_id, to_id):
|
||||
fromfile=from_id,
|
||||
tofile=to_id,
|
||||
)
|
||||
error_message = (
|
||||
u'Different tests were collected between {from_id} and {to_id}. '
|
||||
u'The difference is:\n'
|
||||
u'{diff}'
|
||||
error_message = py.builtin._totext(
|
||||
'Different tests were collected between {from_id} and {to_id}. '
|
||||
'The difference is:\n'
|
||||
'{diff}'
|
||||
).format(from_id=from_id, to_id=to_id, diff='\n'.join(diff))
|
||||
|
||||
raise AssertionError(error_message)
|
||||
msg = "\n".join([x.rstrip() for x in error_message.split("\n")])
|
||||
raise AssertionError(msg)
|
||||
|
||||
|
||||
class Interrupted(KeyboardInterrupt):
|
||||
|
||||
@@ -128,7 +128,7 @@ if __name__ == '__channelexec__':
|
||||
# python3.2 is not concurrent import safe, so let's play it safe
|
||||
# https://bitbucket.org/hpk42/pytest/issue/347/pytest-xdist-and-python-32
|
||||
if sys.version_info[:2] == (3,2):
|
||||
os.environ["PYTHONDONTWRITEBYTECODE"] = 1
|
||||
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
|
||||
slaveinput,args,option_dict = channel.receive()
|
||||
importpath = os.getcwd()
|
||||
sys.path.insert(0, importpath) # XXX only for remote situations
|
||||
|
||||
Reference in New Issue
Block a user