fix(tests): e2e_env overrides conftest's AppConfig.from_file stub

The autouse fixture in conftest.py stubs AppConfig.from_file to return a
minimal config (no models) so unit tests don't need a real config.yaml.
TestConfigManagement in test_client_e2e asserts that the client loads a
real e2e config with a known model, which broke in CI after the
conftest change.

Make e2e_env monkey-patch AppConfig.from_file to return _make_e2e_config()
so DeerFlowClient loads the e2e-specific config when the fixture runs.
This commit is contained in:
greatmengqi 2026-04-17 11:51:51 +08:00
parent 6beea682d2
commit 06f0083a76

View File

@ -102,6 +102,11 @@ def e2e_env(tmp_path, monkeypatch):
monkeypatch.setattr("deerflow.config.paths._paths", None)
monkeypatch.setattr("deerflow.sandbox.sandbox_provider._default_sandbox_provider", None)
# 1b. Override the autouse ``AppConfig.from_file`` stub from conftest
# (minimal test config) with the e2e-specific config that carries a
# real model entry and disables title/memory/summarization.
monkeypatch.setattr(AppConfig, "from_file", staticmethod(lambda config_path=None: _make_e2e_config()))
# 2. Exclude TitleMiddleware from the chain.
# It triggers an extra LLM call to generate a thread title, which adds
# non-determinism and cost to E2E tests (title generation is already