test: 补充知识处理、检索与 Agent 回归用例
覆盖切块、向量检索、工具调用和历史预算;模型相关用例使用桩。
This commit is contained in:
1 parent
2dd062787d
commit
d9fe727c3f
123 files changed
+29005
No files matched your search
@@ -0,0 +1,53 @@
|
||||
"""
|
||||
Copyright 2024-2026 ReplyPier
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from app.core import edition
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def clean_meta_path():
|
||||
saved = list(sys.meta_path)
|
||||
yield
|
||||
sys.meta_path[:] = saved
|
||||
|
||||
|
||||
def _blockers():
|
||||
return [f for f in sys.meta_path if isinstance(f, edition._BlockEnterprise)]
|
||||
|
||||
|
||||
def test_apply_without_flag_installs_nothing(monkeypatch, clean_meta_path):
|
||||
monkeypatch.delenv("NO_ENTERPRISE", raising=False)
|
||||
sys.meta_path[:] = [f for f in sys.meta_path if not isinstance(f, edition._BlockEnterprise)]
|
||||
|
||||
edition.apply()
|
||||
|
||||
assert _blockers() == []
|
||||
|
||||
|
||||
def test_apply_with_flag_blocks_enterprise_imports_once(monkeypatch, clean_meta_path):
|
||||
monkeypatch.setenv("NO_ENTERPRISE", "1")
|
||||
|
||||
edition.apply()
|
||||
edition.apply()
|
||||
|
||||
assert len(_blockers()) == 1
|
||||
with pytest.raises(ModuleNotFoundError):
|
||||
_blockers()[0].find_spec("app.enterprise.models")
|
||||
assert _blockers()[0].find_spec("app.models") is None
|
||||
Reference in new issue
Block a user