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