mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 17:55:26 -04:00
refactor(tests): reuse CLI loader in more tests (#2571)
This commit is contained in:
committed by
GitHub
parent
ae48ea7064
commit
51e668ce60
@@ -1,24 +1,15 @@
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import sys
|
||||
import types
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
from tests.helpers.cli_loader import load_script
|
||||
|
||||
|
||||
def _load_cli(monkeypatch):
|
||||
svc = types.ModuleType("services.memory.skills")
|
||||
svc.SkillsManager = MagicMock()
|
||||
monkeypatch.setitem(sys.modules, "services.memory.skills", svc)
|
||||
path = ROOT / "scripts" / "odysseus-skills"
|
||||
loader = importlib.machinery.SourceFileLoader("odysseus_skills_cli", str(path))
|
||||
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
return load_script("odysseus-skills")
|
||||
|
||||
|
||||
def test_skill_entries_skips_invalid_rows(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user