Move runtests-pyhttpd.sh from test/ to test/pyhttpd/runtests.sh
to match the pytest_suite/runtests.sh naming convention.
- Update internal paths: $here/pyhttpd/... -> $here/... since $here
now resolves to test/pyhttpd/ itself.
- Update run-all-tests.sh to call ./pyhttpd/runtests.sh.
- Update README.pytest and .claude/settings.local.json references.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@
1934955 13f79535-47bb-0310-9956-
ffa450edef68
Infrastructure
--------------
-The test cases rely on the classes provided in 'test/pyhttpd'
-for common code in managing a httpd test instance and do
-provide some base setups:
+The test cases rely on the classes provided in `test/pyhttpd/` (where
+`test/pyhttpd/runtests.sh` runs the suite) for common code in managing
+a httpd test instance and do provide some base setups:
- a small set of virtual hosts with some files
- access to paths and definitions (env fixture)
- start/stop httpd and inspect the error log
--- /dev/null
+#!/bin/sh
+#
+# runtests.sh -- run the pyhttpd modules/ test suite.
+#
+# Manages a local .venv under pyhttpd/ so that pytest and the CGI helper scripts
+# (which httpd forks) both use the same Python with all required packages
+# (cryptography, python-multipart, websockets, etc.) available.
+#
+# Usage:
+# ./runtests.sh # run all modules/ tests
+# ./runtests.sh modules/http1 # run a specific suite
+# ./runtests.sh -k post -v # any pytest args pass through
+#
+# Environment:
+# PYHTTPD_TARGETS space-separated list of test paths (default: modules)
+#
+set -eu
+
+here="$(cd "$(dirname "$0")" && pwd)"
+
+PYTEST="$here/.venv/bin/pytest"
+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 --project "$here"
+ elif command -v python3 >/dev/null 2>&1; then
+ echo "runtests.sh: .venv not found; creating with python3 + pip..." >&2
+ python3 -m venv "$here/.venv"
+ # Keep this list in sync with pyproject.toml [project].dependencies
+ "$here/.venv/bin/pip" install --quiet \
+ "pytest>=7.0" cryptography filelock "python-multipart" pyopenssl packaging websockets
+ else
+ echo "runtests.sh: ERROR: $PYTEST not found and neither 'uv' nor 'python3' is on PATH." >&2
+ exit 1
+ fi
+fi
+
+# Prepend the venv's bin dir so that CGI scripts forked by httpd also resolve
+# python3 to the venv's interpreter (which has all packages installed), and so
+# that any shim wrappers earlier on PATH are shadowed.
+export PATH="$here/.venv/bin:$PATH"
+
+targets="${PYHTTPD_TARGETS:-modules}"
+
+# shellcheck disable=SC2086
+echo "runtests.sh: $PYTEST $targets $*" >&2
+exec "$PYTEST" $targets "$@"
echo " build httpd with its test config (configure) to run these." >&2
return 0
fi
- # runtests-pyhttpd.sh manages the venv, prepends its bin/ to PATH (so CGI
+ # runtests.sh manages the venv, prepends its bin/ to PATH (so CGI
# scripts forked by httpd also use the venv's Python), and runs pytest.
# PYHTTPD_TARGETS can override which modules/ subdirs are run.
# shellcheck disable=SC2086
- ( cd "$here" && ./runtests-pyhttpd.sh $flags ) || return $?
+ ( cd "$here/pyhttpd" && ./runtests.sh $flags ) || return $?
}
case "$only" in
+++ /dev/null
-#!/bin/sh
-#
-# runtests-pyhttpd.sh -- run the pyhttpd modules/ test suite.
-#
-# Manages a local .venv under test/pyhttpd/ so that pytest and the CGI helper scripts
-# (which httpd forks) both use the same Python with all required packages
-# (cryptography, python-multipart, websockets, etc.) available.
-#
-# Usage:
-# ./runtests-pyhttpd.sh # run all modules/ tests
-# ./runtests-pyhttpd.sh modules/http1 # run a specific suite
-# ./runtests-pyhttpd.sh -k post -v # any pytest args pass through
-#
-# Environment:
-# PYHTTPD_TARGETS space-separated list of test paths (default: modules)
-#
-set -eu
-
-here="$(cd "$(dirname "$0")" && pwd)"
-cd "$here"
-
-PYTEST="$here/pyhttpd/.venv/bin/pytest"
-if [ ! -x "$PYTEST" ]; then
- if command -v uv >/dev/null 2>&1; then
- echo "runtests-pyhttpd.sh: .venv not found; running 'uv sync' to create it..." >&2
- uv sync --project "$here/pyhttpd"
- elif command -v python3 >/dev/null 2>&1; then
- echo "runtests-pyhttpd.sh: .venv not found; creating with python3 + pip..." >&2
- python3 -m venv "$here/pyhttpd/.venv"
- # Keep this list in sync with pyhttpd/pyproject.toml [project].dependencies
- "$here/pyhttpd/.venv/bin/pip" install --quiet \
- "pytest>=7.0" cryptography filelock "python-multipart" pyopenssl packaging websockets
- else
- echo "runtests-pyhttpd.sh: ERROR: $PYTEST not found and neither 'uv' nor 'python3' is on PATH." >&2
- exit 1
- fi
-fi
-
-# Prepend the venv's bin dir so that CGI scripts forked by httpd also resolve
-# python3 to the venv's interpreter (which has all packages installed), and so
-# that any shim wrappers earlier on PATH are shadowed.
-export PATH="$here/pyhttpd/.venv/bin:$PATH"
-
-targets="${PYHTTPD_TARGETS:-modules}"
-
-# shellcheck disable=SC2086
-echo "runtests-pyhttpd.sh: $PYTEST $targets $*" >&2
-exec "$PYTEST" $targets "$@"