Skip to content

Commit

Permalink
[melobot] Update test config
Browse files Browse the repository at this point in the history
  • Loading branch information
aicorein committed Oct 14, 2024
1 parent a5340c0 commit 15db83f
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 95 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
for i in $(ls *requirements.txt);
do
pip install -r $i
Expand Down
12 changes: 6 additions & 6 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,12 @@ trace = {shell = "viztracer"}
deps = {shell = "pydeps src/melobot -o pydeps.png -T png --only melobot --rankdir BT --max-module-depth 2 --start-color 160"}
docs = {call = "docs.make:main"}

_requires = {call = "scripts.export_requires:main"}
_doc_requires = {call = "scripts.export_doc_requires:main"}
_onebot_requires = {call = "scripts.export_onebot_requires:main"}
post_install = {composite = ["_requires", "_doc_requires", "_onebot_requires"]}
_requires = {call = "scripts.exports:main"}
post_install.composite = ["_requires"]

[tool.pdm.dev-dependencies]
test = [
"pytest>=8.1.1",
"viztracer>=0.16.2",
"pytest-asyncio>=0.24.0",
]
docs = [
Expand All @@ -106,7 +103,6 @@ docs = [
]
lint = [
"black>=24.2.0",
"pydeps>=1.12.19",
"isort>=5.13.2",
"flake8>=7.0.0",
"pylint>=3.2.6",
Expand All @@ -115,3 +111,7 @@ lint = [
manage = [
"toml>=0.10.2",
]
measure = [
"viztracer>=0.16.3",
"pydeps>=1.12.20",
]
28 changes: 0 additions & 28 deletions scripts/export_doc_requires.py

This file was deleted.

28 changes: 0 additions & 28 deletions scripts/export_onebot_requires.py

This file was deleted.

27 changes: 0 additions & 27 deletions scripts/export_requires.py

This file was deleted.

52 changes: 52 additions & 0 deletions scripts/exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from pathlib import Path

import toml

os.chdir(str(Path(__file__).parent.parent.absolute().resolve(strict=True)))
with open(r"pyproject.toml", "r", encoding="utf-8") as fp:
pyproj_toml = toml.load(fp)

except_groups = (
pyproj_toml["tool"]["pdm"]["dev-dependencies"]
| pyproj_toml["project"]["optional-dependencies"]
)


def get_nega_groups(group: str | None = None) -> str:
groups = except_groups.copy()
if group is not None:
groups.pop(group)
return ",".join(groups)


def main() -> None:
ret = os.system(f"pdm export -o requirements.txt --without {get_nega_groups()}")
if ret == 0:
print("已刷新项目的 requirements.txt")
else:
print("未能完成刷新项目的 requirements.txt 的任务")

ret = os.system(
f"pdm export -o tests/requirements.txt --without {get_nega_groups('test')}"
)
if ret == 0:
print("已刷新项目测试的 requirements.txt")
else:
print("未能完成刷新项目测试的 requirements.txt 的任务")

ret = os.system(
f"pdm export -o docs/requirements.txt --without {get_nega_groups('docs')}"
)
if ret == 0:
print("已刷新文档构建的 requirements.txt")
else:
print("未能完成刷新文档构建的 requirements.txt 的任务")

ret = os.system(
f"pdm export -o onebot_requirements.txt --without {get_nega_groups('onebot')}"
)
if ret == 0:
print("已刷新 protocols.onebot 的 requirements.txt")
else:
print("未能完成刷新 protocols.onebot 的 requirements.txt 的任务")
51 changes: 51 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This file is @generated by PDM.
# Please do not edit it manually.

beartype==0.19.0 \
--hash=sha256:33b2694eda0daf052eb2aff623ed9a8a586703bbf0a90bbc475a83bbf427f699 \
--hash=sha256:de42dfc1ba5c3710fde6c3002e3bd2cad236ed4d2aabe876345ab0b4234a6573
better-exceptions==0.3.3 \
--hash=sha256:9c70b1c61d5a179b84cd2c9d62c3324b667d74286207343645ed4306fdaad976 \
--hash=sha256:e4e6bc18444d5f04e6e894b10381e5e921d3d544240418162c7db57e9eb3453b
colorama==0.4.6; sys_platform == "win32" or platform_system == "Windows" \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
colorlog==6.8.2 \
--hash=sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44 \
--hash=sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33
exceptiongroup==1.2.2; python_version < "3.11" \
--hash=sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b \
--hash=sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc
iniconfig==2.0.0 \
--hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
markdown-it-py==3.0.0 \
--hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \
--hash=sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb
mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
packaging==24.1 \
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124
pluggy==1.5.0 \
--hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \
--hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669
pygments==2.18.0 \
--hash=sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199 \
--hash=sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a
pytest==8.3.3 \
--hash=sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181 \
--hash=sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2
pytest-asyncio==0.24.0 \
--hash=sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b \
--hash=sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276
rich==13.9.2 \
--hash=sha256:51a2c62057461aaf7152b4d611168f93a9fc73068f8ded2790f29fe2b5366d0c \
--hash=sha256:8c82a3d3f8dcfe9e734771313e606b39d8247bb6b826e196f4914b333b743cf1
tomli==2.0.1; python_version < "3.11" \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
typing-extensions==4.12.2 \
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8

0 comments on commit 15db83f

Please sign in to comment.