mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 09:45:24 -04:00
refactor(tests): reuse CLI loader in more tests (#2571)
This commit is contained in:
committed by
GitHub
parent
ae48ea7064
commit
51e668ce60
@@ -4,22 +4,10 @@
|
||||
(e.g. None) raised TypeError once any *.log file existed. Non-strings now
|
||||
return None (no match).
|
||||
"""
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _load():
|
||||
loader = importlib.machinery.SourceFileLoader("odysseus_logs_cli", str(ROOT / "scripts" / "odysseus-logs"))
|
||||
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(m)
|
||||
return m
|
||||
from tests.helpers.cli_loader import load_script
|
||||
|
||||
|
||||
def test_non_string_name_returns_none():
|
||||
cli = _load()
|
||||
cli = load_script("odysseus-logs")
|
||||
assert cli._resolve(None) is None
|
||||
assert cli._resolve(123) is None
|
||||
|
||||
Reference in New Issue
Block a user