1import os, glob, pytest23def _model_dir():4 env = os.environ.get("TITAN_MODEL_DIR")5 if env:6 return env7 hits = glob.glob(os.path.expanduser("~/.cache/huggingface/hub/models--mlx-community--OLMoE-1B-7B-0125-Instruct-4bit/snapshots/*"))8 return hits[0] if hits else None910def _model_dirs():11 env = os.environ.get("TITAN_MODEL_DIRS")12 if env:13 return [d for d in env.split(":") if d]14 d = _model_dir()15 return [d] if d else []1617def pytest_generate_tests(metafunc):18 if "model_dir" in metafunc.fixturenames:19 dirs = _model_dirs()20 metafunc.parametrize("model_dir", dirs or [None], ids=[os.path.basename(os.path.dirname(os.path.dirname(d))) if d else "none" for d in dirs] or ["none"], scope="module")2122@pytest.fixture(autouse=True)23def _skip_if_no_model(request):24 if "model_dir" in request.fixturenames and request.getfixturevalue("model_dir") is None:25 pytest.skip("no MoE checkpoint in the HF cache (set TITAN_MODEL_DIRS)")26