Skip to content

Commit 53207f4

Browse files
Enhance reranker batch test setup
- Added pytest integration to skip tests when `config.yml` is not found, improving test reliability in CI environments. - Refactored configuration loading to use a variable for the config file path, enhancing code clarity and maintainability.
1 parent 8c25b79 commit 53207f4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

backend/scripts/test_reranker_batch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@
55

66
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
77

8+
import pytest
9+
10+
_script_dir = os.path.dirname(__file__)
11+
_config_yml = os.path.join(_script_dir, "..", "config.yml")
12+
13+
# Skip when config.yml not found (e.g. CI where it's gitignored)
14+
if not os.path.exists(_config_yml):
15+
pytest.skip("config.yml not found, skipping reranker batch test", allow_module_level=True)
16+
817
import httpx
918
from narrative_mirror.config import load_config
1019

11-
cfg = load_config(os.path.join(os.path.dirname(__file__), "..", "config.yml"))
20+
cfg = load_config(_config_yml)
1221
r = cfg.reranker
1322

1423
base_url = r.base_url.rstrip("/")

0 commit comments

Comments
 (0)