mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-29 11:56:02 +08:00
* fix(qqofficial): preserve native mentions and reply sequences (LANG-181) Co-authored-by: multica-agent <[email protected]> * fix(qqofficial): respect group mention rendering capability Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: multica-agent <[email protected]>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
import tomllib
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
import yaml
|
|
from packaging.requirements import Requirement
|
|
|
|
PLUGIN_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _sdk_requirements():
|
|
project = tomllib.loads((PLUGIN_ROOT / "pyproject.toml").read_text())
|
|
packaged = (PLUGIN_ROOT / "requirements.txt").read_text().splitlines()
|
|
return [
|
|
next(Requirement(line) for line in requirements if line.startswith("langbot-plugin"))
|
|
for requirements in (project["project"]["dependencies"], packaged)
|
|
]
|
|
|
|
|
|
def test_project_and_packaged_sdk_constraints_match():
|
|
project, packaged = _sdk_requirements()
|
|
assert project.specifier == packaged.specifier
|
|
assert str(project.specifier) == "<0.8.0,>=0.7.18"
|
|
|
|
|
|
@pytest.mark.parametrize("version", ["0.7.18", "0.7.19", "0.7.99"])
|
|
def test_sdk_constraints_accept_compatible_stable_patches(version):
|
|
assert all(requirement.specifier.contains(version) for requirement in _sdk_requirements())
|
|
|
|
|
|
@pytest.mark.parametrize("version", ["0.7.16", "0.7.17", "0.8.0", "1.0.0"])
|
|
def test_sdk_constraints_reject_unverified_versions(version):
|
|
assert not any(requirement.specifier.contains(version) for requirement in _sdk_requirements())
|
|
|
|
|
|
def test_manifest_and_project_versions_match():
|
|
project = tomllib.loads((PLUGIN_ROOT / "pyproject.toml").read_text())
|
|
manifest = yaml.safe_load((PLUGIN_ROOT / "manifest.yaml").read_text())
|
|
assert project["project"]["version"] == manifest["metadata"]["version"]
|