forked from hyphen-2025/cyber-pilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
33 lines (26 loc) · 970 Bytes
/
conftest.py
File metadata and controls
33 lines (26 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import annotations
import sys
from pathlib import Path
import pytest
# Python <3.11 does not have stdlib tomllib; use tomli as a fallback.
if sys.version_info < (3, 11):
try:
import tomli as _tomli
sys.modules.setdefault("tomllib", _tomli)
except ImportError:
pass
def pytest_configure() -> None:
repo_root = Path(__file__).resolve().parents[1]
tests_dir = repo_root / "tests"
sys.path.insert(0, str(tests_dir))
cypilot_scripts_dir = repo_root / "skills" / "cypilot" / "scripts"
sys.path.insert(0, str(cypilot_scripts_dir))
overwork_alert_src_dir = repo_root / "examples" / "overwork_alert" / "src"
sys.path.insert(0, str(overwork_alert_src_dir))
@pytest.fixture(autouse=True)
def _enable_json_mode():
"""Enable JSON output mode for all tests (tests expect JSON on stdout)."""
from cypilot.utils.ui import set_json_mode
set_json_mode(True)
yield
set_json_mode(False)