def _testinfra_backend(pytestconfig, _testinfra_host): kwargs = {} if pytestconfig.option.ssh_config is not None: kwargs["ssh_config"] = pytestconfig.option.ssh_config if pytestconfig.option.sudo is not None: kwargs["sudo"] = pytestconfig.option.sudo if _testinfra_host is not None: backend_type = pytestconfig.option.connection or "paramiko" testinfra.set_backend(backend_type, _testinfra_host, **kwargs) else: testinfra.set_backend("local", **kwargs)
def testinfra_backend(request, pytestconfig): kwargs = {} if pytestconfig.option.ssh_config is not None: kwargs["ssh_config"] = pytestconfig.option.ssh_config if pytestconfig.option.sudo is not None: kwargs["sudo"] = pytestconfig.option.sudo if request.param is not None: backend_type = pytestconfig.option.connection or "paramiko" testinfra.set_backend( backend_type, request.param, **kwargs) else: testinfra.set_backend("local", **kwargs)
def _testinfra_backend(pytestconfig, _testinfra_host): kwargs = {} if pytestconfig.option.ssh_config is not None: kwargs["ssh_config"] = pytestconfig.option.ssh_config if pytestconfig.option.sudo is not None: kwargs["sudo"] = pytestconfig.option.sudo if _testinfra_host is not None: backend_type = pytestconfig.option.connection or "paramiko" testinfra.set_backend( backend_type, _testinfra_host, **kwargs) else: testinfra.set_backend("local", **kwargs)