Use a supported Python for workflow tests

This commit is contained in:
2026-07-13 14:06:13 +02:00
parent 084a0b5058
commit eabf2273a7
5 changed files with 28 additions and 12 deletions

View File

@@ -8,7 +8,7 @@ main_branch = "main"
[workflow]
branch_prefix = "us"
require_ci = false
required_tests = ["python3 -m unittest discover -s tests -v"]
required_tests = ["scripts/python -m unittest discover -s tests -v"]
[safety]
max_file_bytes = 5000000

View File

@@ -12,8 +12,8 @@ Requirements: Python 3.11+, Git, and an authenticated `tea` login named `domvers
scripts/work-item next
scripts/work-item claim
scripts/work-item status
scripts/work-item submit --test "python3 -m unittest discover -s tests -v"
scripts/work-item submit --test "python3 -m unittest discover -s tests -v" --yes
scripts/work-item submit --test "scripts/python -m unittest discover -s tests -v"
scripts/work-item submit --test "scripts/python -m unittest discover -s tests -v" --yes
scripts/work-item complete --merge
scripts/work-item block --reason "precise blocking condition"
```
@@ -28,5 +28,5 @@ machine-readable source of truth; the Gitea Project board is the visual view.
## Tests
```bash
python3 -m unittest discover -s tests -v
scripts/python -m unittest discover -s tests -v
```

11
scripts/python Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
for python in python3.13 python3.12 python3.11; do
if command -v "$python" >/dev/null 2>&1; then
exec "$python" "$@"
fi
done
echo "photoanalyzer: Python 3.11 or newer is required" >&2
exit 2

View File

@@ -1,11 +1,5 @@
#!/bin/sh
set -eu
for python in python3.13 python3.12 python3.11; do
if command -v "$python" >/dev/null 2>&1; then
exec "$python" -m work_item "$@"
fi
done
echo "work-item: Python 3.11 or newer is required" >&2
exit 2
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
exec "$SCRIPT_DIR/python" -m work_item "$@"

View File

@@ -219,5 +219,16 @@ class CliEndToEndTests(unittest.TestCase):
self.assertIn("Provider fixture unavailable", self.state()["comments"][-1]["body"])
class InterpreterWrapperTests(unittest.TestCase):
def test_wrapper_selects_supported_python(self) -> None:
result = run(
[str(SOURCE_ROOT / "scripts" / "python"), "-c", "import sys; print(sys.version_info[:2])"],
cwd=SOURCE_ROOT,
)
major, minor = eval(result.stdout.strip(), {"__builtins__": {}})
self.assertEqual(major, 3)
self.assertGreaterEqual(minor, 11)
if __name__ == "__main__":
unittest.main()