]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
test/pytest_suite: auto-create .venv via python3+pip when uv is unavailable
authorJim Jagielski <jim@apache.org>
Wed, 3 Jun 2026 19:05:31 +0000 (19:05 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 3 Jun 2026 19:05:31 +0000 (19:05 +0000)
runtests.sh already bootstrapped the virtualenv with `uv sync` when uv
was present, but exited with an error when it was not.  Fall back to
`python3 -m venv .venv && .venv/bin/pip install -e .` so the suite is
self-bootstrapping on systems that have only a stock Python 3 install.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934945 13f79535-47bb-0310-9956-ffa450edef68

test/pytest_suite/runtests.sh

index b4831ff48f2d1bd879029937f025f01d9a42169d..a22501012ae0f4218a4e374f0e4af66a33638eca 100755 (executable)
@@ -35,11 +35,12 @@ if [ ! -x "$PYTEST" ]; then
     if command -v uv >/dev/null 2>&1; then
         echo "runtests.sh: .venv not found; running 'uv sync' to create it..." >&2
         uv sync
+    elif command -v python3 >/dev/null 2>&1; then
+        echo "runtests.sh: .venv not found; creating it with python3 + pip..." >&2
+        python3 -m venv .venv
+        .venv/bin/pip install --quiet -e .
     else
-        echo "runtests.sh: ERROR: $PYTEST not found and 'uv' is not installed." >&2
-        echo "  Create the environment with one of:" >&2
-        echo "    uv sync" >&2
-        echo "    python3 -m venv .venv && .venv/bin/pip install pytest httpx" >&2
+        echo "runtests.sh: ERROR: $PYTEST not found and neither 'uv' nor 'python3' is installed." >&2
         exit 1
     fi
 fi