"""司机安卓端 fixtures — Appium + 登录态复用。""" import pytest from tests.core.appium_support import ( create_driver, make_ensure_logged_in, save_failure_screenshot, ) @pytest.fixture def driver(driver_android_config, request): """司机安卓端 driver (noReset=true)。""" cfg = driver_android_config d = None try: d = create_driver(cfg, platform="android") yield d save_failure_screenshot(d, cfg, "android", request) finally: if d is not None: try: d.quit() except Exception: pass @pytest.fixture def ensure_logged_in(driver_android_config, config): """确保已登录态(司机角色)。""" fn = make_ensure_logged_in(driver_android_config, config, account_role="driver") return lambda d: fn(d)