mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -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,10 @@
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _load_cli():
|
||||
path = ROOT / "scripts" / "odysseus-preset"
|
||||
loader = importlib.machinery.SourceFileLoader("odysseus_preset_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
|
||||
from tests.helpers.cli_loader import load_script
|
||||
|
||||
|
||||
def test_load_rejects_non_object_preset_store(tmp_path, capsys):
|
||||
cli = _load_cli()
|
||||
cli = load_script("odysseus-preset")
|
||||
cli._PATH = tmp_path / "presets.json"
|
||||
cli._PATH.write_text("[]")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user