declare xdist-related hooks directly here (requires a recent py-trunk)
This commit is contained in:
5
setup.py
5
setup.py
@@ -7,10 +7,11 @@ for the new options.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
from xdist import __version__
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pytest-xdist",
|
name="pytest-xdist",
|
||||||
version="1.1",
|
version=__version__,
|
||||||
description='py.test figleaf coverage plugin',
|
description='py.test figleaf coverage plugin',
|
||||||
long_description=__doc__,
|
long_description=__doc__,
|
||||||
license='GPLv2 or later',
|
license='GPLv2 or later',
|
||||||
@@ -21,7 +22,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.4', 'py>=1.2.0'],
|
install_requires = ['execnet>=1.0.6', 'py>=1.2.2'],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import os
|
|||||||
from xdist.gwmanage import GatewayManager, HostRSync
|
from xdist.gwmanage import GatewayManager, HostRSync
|
||||||
from py._test.pluginmanager import HookRelay, Registry
|
from py._test.pluginmanager import HookRelay, Registry
|
||||||
from py._plugin import hookspec
|
from py._plugin import hookspec
|
||||||
|
from xdist import newhooks
|
||||||
import execnet
|
import execnet
|
||||||
|
|
||||||
def pytest_funcarg__hookrecorder(request):
|
def pytest_funcarg__hookrecorder(request):
|
||||||
@@ -11,7 +12,7 @@ def pytest_funcarg__hookrecorder(request):
|
|||||||
return _pytest.gethookrecorder(hook)
|
return _pytest.gethookrecorder(hook)
|
||||||
|
|
||||||
def pytest_funcarg__hook(request):
|
def pytest_funcarg__hook(request):
|
||||||
return HookRelay(hookspec, Registry())
|
return HookRelay([hookspec, newhooks], Registry())
|
||||||
|
|
||||||
class TestGatewayManagerPopen:
|
class TestGatewayManagerPopen:
|
||||||
def test_popen_no_default_chdir(self, hook):
|
def test_popen_no_default_chdir(self, hook):
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
__version__ = "1.1"
|
__version__ = "1.2"
|
||||||
|
|
||||||
|
|||||||
21
xdist/newhooks.py
Normal file
21
xdist/newhooks.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
def pytest_gwmanage_newgateway(gateway, platinfo):
|
||||||
|
""" called on new raw gateway creation. """
|
||||||
|
|
||||||
|
def pytest_gwmanage_rsyncstart(source, gateways):
|
||||||
|
""" called before rsyncing a directory to remote gateways takes place. """
|
||||||
|
|
||||||
|
def pytest_gwmanage_rsyncfinish(source, gateways):
|
||||||
|
""" called after rsyncing a directory to remote gateways takes place. """
|
||||||
|
|
||||||
|
def pytest_testnodeready(node):
|
||||||
|
""" Test Node is ready to operate. """
|
||||||
|
|
||||||
|
def pytest_testnodedown(node, error):
|
||||||
|
""" Test Node is down. """
|
||||||
|
|
||||||
|
def pytest_rescheduleitems(items):
|
||||||
|
""" reschedule Items from a node that went down. """
|
||||||
|
|
||||||
|
def pytest_looponfailinfo(failreports, rootdirs):
|
||||||
|
""" info for repeating failing tests. """
|
||||||
@@ -173,6 +173,16 @@ def pytest_addoption(parser):
|
|||||||
group.addoption('--rsyncdir', action="append", default=[], metavar="dir1",
|
group.addoption('--rsyncdir', action="append", default=[], metavar="dir1",
|
||||||
help="add directory for rsyncing to remote tx nodes.")
|
help="add directory for rsyncing to remote tx nodes.")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# distributed testing hooks
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
def pytest_registerhooks(pluginmanager):
|
||||||
|
from xdist import newhooks
|
||||||
|
pluginmanager.registerhooks(newhooks)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# distributed testing initialization
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
if config.option.numprocesses:
|
if config.option.numprocesses:
|
||||||
config.option.dist = "load"
|
config.option.dist = "load"
|
||||||
|
|||||||
Reference in New Issue
Block a user