mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-31 04:57:23 +08:00
test: 隔离单测中的站点原生资源 (#6452)
* test: isolate native site resources * refactor(test): retain sites stub helper contract * fix(test): preserve sites stub probe imports --------- Co-authored-by: jxxghp <jxxghp@gmail.com>
This commit is contained in:
@@ -16,10 +16,10 @@ PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(PROJECT_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from app.testing.bootstrap import install_sites_stub, isolate_config_dir
|
||||
from app.testing.bootstrap import ensure_sites_stub, isolate_config_dir
|
||||
|
||||
isolate_config_dir()
|
||||
install_sites_stub()
|
||||
ensure_sites_stub()
|
||||
|
||||
from app.startup import lifecycle
|
||||
from app.startup.initializers import modules as modules_initializer
|
||||
|
||||
@@ -43,9 +43,9 @@ import json
|
||||
import sys
|
||||
import time
|
||||
|
||||
from app.testing.bootstrap import install_sites_stub
|
||||
from app.testing.bootstrap import ensure_sites_stub
|
||||
|
||||
install_sites_stub()
|
||||
ensure_sites_stub()
|
||||
before = set(sys.modules)
|
||||
started_at = time.perf_counter()
|
||||
importlib.import_module({target!r})
|
||||
@@ -100,9 +100,9 @@ import time
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.testing.bootstrap import install_sites_stub
|
||||
from app.testing.bootstrap import ensure_sites_stub
|
||||
|
||||
install_sites_stub()
|
||||
ensure_sites_stub()
|
||||
from app.startup import lifecycle
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user