def _load_backend(self, tool, backend): """Load a *backend* callable for *tool*. Consults the [tool.backends] section of the active configuration first for a "tool = evalable.dotted:path" entry. If not found, looks in the process-wide registry of built-in and pkg_resources managed backends. A config entry will override an equivalently named process entry. """ point_of_service_managers = self.config.get_section( '%(tool)s.backends', default={}, logger=self.logger, tool=tool) try: entry = point_of_service_managers[backend] except KeyError: pass else: if callable(entry): return entry else: return eval_dotted_path(entry) entry = managers[tool][backend] if callable(entry): return entry fn = eval_dotted_path(entry) managers[tool].setdefault(backend, fn) return fn
def create(self): from alfajor.browsers.wsgi import WSGI entry_point = self.config['server-entry-point'] app = eval_dotted_path(entry_point) base_url = self.config.get('base_url') logger.debug("Created in-process WSGI browser.") return WSGI(app, base_url)
def create(self): from alfajor.apiclient import APIClient entry_point = self.config['server-entry-point'] app = eval_dotted_path(entry_point) base_url = self.config.get('base_url') logger.debug("Created in-process WSGI api client rooted at %s.", base_url) return APIClient(app, base_url=base_url)
def create(self): base_url = self.server_url if (self._config('without_server', False) or not self._config('cmd', False)): logger.debug("Connecting to existing URL %r", base_url) else: logger.debug("Starting service....") self.process = self.start_subprocess() logger.debug("Service started.") selenium_server = self._config('selenium-server', 'http://localhost:4444') waitexpr = self._config('wait-expression', None) kw = {} if waitexpr: kw = {'wait_expression': eval_dotted_path(waitexpr)} self.browser = self.browser_factory(selenium_server, base_url, **kw) return self.browser