"""pytest conftest — ensure worktree dispatch.* is imported (not main workspace)."""
import pathlib
import sys

REPO_ROOT = pathlib.Path(__file__).resolve().parents[2]
if sys.path and sys.path[0] != str(REPO_ROOT):
    try:
        sys.path.remove(str(REPO_ROOT))
    except ValueError:
        pass
    sys.path.insert(0, str(REPO_ROOT))
for _mod in list(sys.modules.keys()):
    if _mod == "dispatch" or _mod.startswith("dispatch."):
        del sys.modules[_mod]
