def app(request): global fixture path = request.config.getoption("--target") with open(path) as config: target = json.load(config) if fixture is None: browser = request.config.getoption("--browser") fixture = Application(browser) fixture.open(target["url"]) else: if not fixture.is_valid(): browser = request.config.getoption("--browser") fixture = Application(browser) fixture.open(target["url"]) fixture.session.ensure_login(target["username"], target["password"]) return fixture