Use a supported Python for workflow tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
11
scripts/python
Executable 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
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user