def app(request): global fixture browser = request.config.getoption("--browser") web_config = load_config(request.config.getoption("--target"))["web"] if fixture is None or not fixture.is_valid(): fixture = Application(browser=browser) if not fixture.is_logged_in(): fixture.crooked_login(username=web_config['username'], password=web_config["password"]) return fixture