Use a supported Python for workflow tests
This commit is contained in:
@@ -8,7 +8,7 @@ main_branch = "main"
|
|||||||
[workflow]
|
[workflow]
|
||||||
branch_prefix = "us"
|
branch_prefix = "us"
|
||||||
require_ci = false
|
require_ci = false
|
||||||
required_tests = ["python3 -m unittest discover -s tests -v"]
|
required_tests = ["scripts/python -m unittest discover -s tests -v"]
|
||||||
|
|
||||||
[safety]
|
[safety]
|
||||||
max_file_bytes = 5000000
|
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 next
|
||||||
scripts/work-item claim
|
scripts/work-item claim
|
||||||
scripts/work-item status
|
scripts/work-item status
|
||||||
scripts/work-item submit --test "python3 -m unittest discover -s tests -v"
|
scripts/work-item submit --test "scripts/python -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" --yes
|
||||||
scripts/work-item complete --merge
|
scripts/work-item complete --merge
|
||||||
scripts/work-item block --reason "precise blocking condition"
|
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
|
## Tests
|
||||||
|
|
||||||
```bash
|
```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
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
for python in python3.13 python3.12 python3.11; do
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
if command -v "$python" >/dev/null 2>&1; then
|
exec "$SCRIPT_DIR/python" -m work_item "$@"
|
||||||
exec "$python" -m work_item "$@"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "work-item: Python 3.11 or newer is required" >&2
|
|
||||||
exit 2
|
|
||||||
|
|||||||
@@ -219,5 +219,16 @@ class CliEndToEndTests(unittest.TestCase):
|
|||||||
self.assertIn("Provider fixture unavailable", self.state()["comments"][-1]["body"])
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user