Add mise run test-container; pin Wand to the bot's 0.7.2

test-container runs the suite inside dogebot's Red image on yveltal, with
its ImageMagick 6, fonts and the cogs' info.json requirements, and is part
of mise run check. It fails on the copy_alpha bug that reached the bot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
This commit is contained in:
Ziad ArafatandClaude Opus 5.5 committed 2026-11-05 12:21:16 -07:00
1 parent 2120bc6b34
commit b33c060587
6 files changed
+63 -8

No files matched your search

+7
View File
@@ -100,3 +100,10 @@ self-contained, so Red's Downloader installs it without installing this repo as
mise install && mise run sync
mise run fmt && mise run check
```
`mise run check` includes `mise run test-container`, which copies this checkout to yveltal and runs the tests
inside dogebot's Red image (`localhost/dogebot-red:latest`), with the bot's Python, ImageMagick 6, fonts and
the exact requirements from each `info.json`. The dev machine has ImageMagick 7, and the two differ (an
operator name broke pictures once), so run it before pushing anything that draws. Set `DOGEBOT_HOST` or
`DOGEBOT_RED_IMAGE` to test elsewhere; extra arguments go to pytest. Keep `wand` in `pyproject.toml` equal to
`doge_alignment/info.json`. ImageMagick itself is pinned in dogebot's `containers/red/Containerfile`.
+1 -1
View File
@@ -8,7 +8,7 @@
"name": "doge_alignment",
"short": "D&D alignment chart for your server, drawn with members' avatars",
"requirements": [
"Wand>=0.6.13"
"Wand==0.7.2"
],
"description": "A 3x3 D&D alignment chart per server, drawn as one picture or as a gallery of nine, with members' avatars. Slash and text commands (`alignment`), alignment admins, YAML export and import. Needs ImageMagick (libmagickwand) on the bot's host for pictures; without it the chart is shown as text.",
"tags": [
+5 -1
View File
@@ -17,8 +17,12 @@ run = "uv run ty check"
[tasks.test]
run = "uv run pytest"
[tasks.test-container]
description = "Run the tests inside dogebot's Red image on yveltal (its ImageMagick, fonts and Wand)"
run = "scripts/test-container.sh"
[tasks.check]
depends = ["lint", "typecheck", "test"]
depends = ["lint", "typecheck", "test", "test-container"]
[tasks.generate-client]
description = "Regenerate clients/media-preload-client from the live media-preload spec"
+3 -2
View File
@@ -10,8 +10,9 @@ requires-python = ">=3.11"
dependencies = [
# The Red that dogebot runs; cogs get discord.py, PyYAML etc. from it
"red-discordbot==3.5.24",
# doge_alignment pictures (needs ImageMagick's libmagickwand)
"wand>=0.6.13",
# doge_alignment pictures (needs ImageMagick's libmagickwand); keep equal
# to doge_alignment/info.json, which is what the bot installs
"wand==0.7.2",
]
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Run the test suite inside dogebot's Red image, with the Python, ImageMagick,
# fonts and Wand the live bot uses, so differences from the dev machine (such
# as ImageMagick 6 vs 7) fail here instead of in Discord.
#
# DOGEBOT_HOST ssh host with the image (default yveltal_local)
# DOGEBOT_RED_IMAGE image to test in (default localhost/dogebot-red:latest)
# extra arguments go to pytest
set -euo pipefail
cd "$(dirname "$0")/.."
host=${DOGEBOT_HOST:-yveltal_local}
image=${DOGEBOT_RED_IMAGE:-localhost/dogebot-red:latest}
# The cogs' own requirements (what Red's Downloader installs), plus the
# locked test tools. The media-preload client comes from this checkout
# (editable, in the dev group) rather than from GitHub, so it's the code
# under test.
cog_reqs=$(python3 -c 'import json, sys
for f in sys.argv[1:]:
for req in json.load(open(f))["requirements"]:
if not req.startswith("media-preload-client"):
print(req)' */info.json)
test_reqs=$(uv export --frozen --only-group dev --no-hashes --no-emit-project \
| grep -vE '^(ruff|ty)==|^#|^ *#')
dir=$(ssh "$host" mktemp -d)
trap 'ssh "$host" rm -rf "$dir"' EXIT
git ls-files -z --cached --others --exclude-standard \
| tar --null -T - -czf - \
| ssh "$host" tar xzf - -C "$dir"
printf '%s\n' "$cog_reqs" | ssh "$host" "cat > $dir/.cog-requirements.txt"
printf '%s\n' "$test_reqs" | ssh "$host" "cat > $dir/.test-requirements.txt"
# shellcheck disable=SC2029 # $dir and $image expand here on purpose
ssh "$host" "podman run --rm --entrypoint sh -v $dir:/src:Z -w /src \
-e PYTHONDONTWRITEBYTECODE=1 $image -c '
set -e
uv pip install --quiet --python /app/.venv/bin/python \
-r .cog-requirements.txt -r .test-requirements.txt
python -c \"from wand.version import MAGICK_VERSION; print(MAGICK_VERSION)\"
python -m pytest -q -p no:cacheprovider $*
'"
Generated
+4 -4
View File
@@ -376,7 +376,7 @@ dev = [
[package.metadata]
requires-dist = [
{ name = "red-discordbot", specifier = "==3.5.24" },
{ name = "wand", specifier = ">=0.6.13" },
{ name = "wand", specifier = "==0.7.2" },
]
[package.metadata.requires-dev]
@@ -1134,11 +1134,11 @@ wheels = [
[[package]]
name = "wand"
version = "0.6.13"
version = "0.7.2"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/41/0b/005ab483df0bf48d65fe26cc1036ce222521ece3a84e55b501a4f966746c/Wand-0.6.13.tar.gz", hash = "sha256:f5013484eaf7a20eb22d1821aaefe60b50cc329722372b5f8565d46d4aaafcca", size = 11883700, upload-time = "2023-11-03T23:18:41.79Z" }
sdist = { url = "https://files.pythonhosted.org/packages/85/27/98de4383d028df318b9dd56e7ac2a8437684db18c2da7204c084f37e8f95/wand-0.7.2.tar.gz", hash = "sha256:0387fd08848d00cadd1d885fcb19a17dd4250df2029e5338b6b668b7fed64b5b", size = 11889993, upload-time = "2026-06-25T13:48:31.512Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/59/d5/1bdd7c9662d5e9078e25ba0eb69bdb122859295746d40ab8dfef3a7b4d42/Wand-0.6.13-py2.py3-none-any.whl", hash = "sha256:e5dda0ac2204a40c29ef5c4cb310770c95d3d05c37b1379e69c94ea79d7d19c0", size = 143789, upload-time = "2023-11-03T23:18:50.474Z" },
{ url = "https://files.pythonhosted.org/packages/fb/11/764bee6e793c01d6ce7b99f4872f9fd5ef89904b172cb9d8a0a1dae02f21/wand-0.7.2-py3-none-any.whl", hash = "sha256:7db97c5e51862fdd5e58866dbf34e2dcae295245511147367690a3e17f459984", size = 145045, upload-time = "2026-06-25T13:48:38.348Z" },
]
[[package]]