2009-04-02 21:57:42 +08:00
|
|
|
pytest_plugins = 'pytest_doctest', 'pytest_pytester' # , 'pytest_restdoc'
|
2009-03-19 05:24:42 +08:00
|
|
|
rsyncignore = ['c-extension/greenlet/build']
|
|
|
|
|
2007-02-09 07:43:27 +08:00
|
|
|
import py
|
2009-03-20 23:36:45 +08:00
|
|
|
class PylibTestconfigPlugin:
|
2009-03-26 20:50:12 +08:00
|
|
|
def pytest_funcarg__specssh(self, pyfuncitem):
|
2009-03-20 23:36:45 +08:00
|
|
|
return getspecssh(pyfuncitem.config)
|
2009-03-26 20:50:12 +08:00
|
|
|
def pytest_funcarg__specsocket(self, pyfuncitem):
|
2009-03-20 23:36:45 +08:00
|
|
|
return getsocketspec(pyfuncitem.config)
|
|
|
|
|
2009-02-27 18:18:27 +08:00
|
|
|
def pytest_addoption(self, parser):
|
|
|
|
group = parser.addgroup("pylib", "py lib testing options")
|
|
|
|
group.addoption('--sshhost',
|
|
|
|
action="store", dest="sshhost", default=None,
|
2009-03-23 04:44:45 +08:00
|
|
|
help=("ssh xspec for ssh functional tests. "))
|
2009-03-20 23:36:45 +08:00
|
|
|
group.addoption('--gx',
|
|
|
|
action="append", dest="gspecs", default=None,
|
2009-03-23 04:44:45 +08:00
|
|
|
help=("add a global test environment, XSpec-syntax. "))
|
2009-02-27 18:18:27 +08:00
|
|
|
group.addoption('--runslowtests',
|
2008-03-01 21:43:33 +08:00
|
|
|
action="store_true", dest="runslowtests", default=False,
|
2009-03-20 23:36:45 +08:00
|
|
|
help=("run slow tests"))
|
|
|
|
|
|
|
|
ConftestPlugin = PylibTestconfigPlugin
|
|
|
|
|
|
|
|
# configuration information for tests
|
|
|
|
def getgspecs(config=None):
|
|
|
|
if config is None:
|
|
|
|
config = py.test.config
|
|
|
|
return [py.execnet.XSpec(spec)
|
|
|
|
for spec in config.getvalueorskip("gspecs")]
|
2009-02-27 18:18:27 +08:00
|
|
|
|
2009-03-20 23:36:45 +08:00
|
|
|
def getspecssh(config=None):
|
|
|
|
xspecs = getgspecs(config)
|
|
|
|
for spec in xspecs:
|
|
|
|
if spec.ssh:
|
|
|
|
if not py.path.local.sysfind("ssh"):
|
|
|
|
py.test.skip("command not found: ssh")
|
|
|
|
return spec
|
2009-03-21 00:28:14 +08:00
|
|
|
py.test.skip("need '--gx ssh=...'")
|
2007-02-09 07:43:27 +08:00
|
|
|
|
2009-03-20 23:36:45 +08:00
|
|
|
def getsocketspec(config=None):
|
|
|
|
xspecs = getgspecs(config)
|
|
|
|
for spec in xspecs:
|
|
|
|
if spec.socket:
|
|
|
|
return spec
|
2009-03-21 00:28:14 +08:00
|
|
|
py.test.skip("need '--gx socket=...'")
|