2009-05-13 07:47:32 +08:00
|
|
|
import py
|
2009-09-06 22:59:39 +08:00
|
|
|
from mysetup2.myapp import MyApp
|
2009-05-13 07:47:32 +08:00
|
|
|
|
2009-05-21 20:36:52 +08:00
|
|
|
def pytest_funcarg__mysetup(request):
|
|
|
|
return MySetup(request)
|
2009-05-13 07:47:32 +08:00
|
|
|
|
2009-05-21 20:36:52 +08:00
|
|
|
def pytest_addoption(parser):
|
|
|
|
parser.addoption("--ssh", action="store", default=None,
|
|
|
|
help="specify ssh host to run tests with")
|
2010-07-27 03:15:15 +08:00
|
|
|
|
2009-05-13 07:47:32 +08:00
|
|
|
|
|
|
|
class MySetup:
|
|
|
|
def __init__(self, request):
|
2010-07-27 03:15:15 +08:00
|
|
|
self.config = request.config
|
2009-05-13 07:47:32 +08:00
|
|
|
|
|
|
|
def myapp(self):
|
|
|
|
return MyApp()
|
|
|
|
|
|
|
|
def getsshconnection(self):
|
|
|
|
host = self.config.option.ssh
|
|
|
|
if host is None:
|
|
|
|
py.test.skip("specify ssh host with --ssh")
|
2009-10-02 22:58:57 +08:00
|
|
|
return execnet.SshGateway(host)
|
2010-07-27 03:15:15 +08:00
|
|
|
|