test: update smoke and regression suites for dual-renderer paths
Offscreen harnesses now resize+show before load, use per-instance webengine profile dirs and explicit exit codes; compaction and bash stream suites follow the renamed internals.
This commit is contained in:
@@ -29,18 +29,11 @@ os.environ.setdefault("HAOCODE_RENDER", "software")
|
||||
os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--disable-gpu"
|
||||
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
|
||||
|
||||
# 铁律:测试不得污染真实 data/chat_history.db
|
||||
import core.db_manager as _dbm # noqa: E402
|
||||
_DB_TMP = os.path.join(tempfile.gettempdir(), f"haocode_test_errpersist_{os.getpid()}.db")
|
||||
if os.path.exists(_DB_TMP):
|
||||
os.remove(_DB_TMP)
|
||||
_dbm._DEFAULT_DB = _DB_TMP
|
||||
|
||||
# 铁律:不得污染真实 data/config.json
|
||||
_CFG_TMP = os.path.join(tempfile.gettempdir(), f"haocode_test_errcfg_{os.getpid()}.json")
|
||||
with open(_CFG_TMP, "w", encoding="utf-8") as _f:
|
||||
_f.write('{"providers": {}}')
|
||||
os.environ["HAOCODE_CONFIG_FILE"] = _CFG_TMP
|
||||
# 铁律(P0-01):临时数据库 + 临时配置必须在 import MainWindow 之前完成
|
||||
from tests._test_env import isolate # noqa: E402
|
||||
_TMP = isolate("errpersist", config={"providers": {}})
|
||||
_DB_TMP = _TMP["db"]
|
||||
_CFG_TMP = _TMP["config"]
|
||||
|
||||
from PyQt6.QtWidgets import QApplication # noqa: E402
|
||||
from PyQt6.QtTest import QTest # noqa: E402
|
||||
|
||||
Reference in New Issue
Block a user