refactor(tests): finish shared CLI loader adoption
Test-only refactor continuing #2523. Replaces remaining obvious CLI/script loader boilerplate with tests.helpers.cli_loader.load_script while preserving existing stubs and assertions.
This commit is contained in:
committed by
GitHub
parent
1f40fbe140
commit
43a101d305
@@ -1,11 +1,10 @@
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import ModuleType, SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.helpers.cli_loader import load_script
|
||||
|
||||
|
||||
class _Conn:
|
||||
def select(self, folder, readonly=True):
|
||||
@@ -46,12 +45,7 @@ def _load_mail_cli(monkeypatch):
|
||||
monkeypatch.setitem(sys.modules, "routes.email_pollers", pollers)
|
||||
monkeypatch.setitem(sys.modules, "core", core_mod)
|
||||
monkeypatch.setitem(sys.modules, "core.database", database_mod)
|
||||
path = Path(__file__).resolve().parent.parent / "scripts" / "odysseus-mail"
|
||||
loader = importlib.machinery.SourceFileLoader("odysseus_mail_cli_read_test", 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-mail")
|
||||
|
||||
|
||||
def test_cmd_read_handles_empty_fetch_payload(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user