Browse Source

Merge pull request #9572 from infosiftr/py-hy

Update python-hy test for newer python + hy versions
Tianon Gravi 4 years ago
parent
commit
ce758ad894

+ 7 - 3
test/tests/python-hy/container.cmd

@@ -14,14 +14,18 @@ exit /b 1
 
 rem Hy is complicated, and uses Python's internal AST representation directly, and thus Hy releases usually lag behind a little on major Python releases (and we don't want that to gum up our tests)
 rem see https://github.com/hylang/hy/issues/1111 for example breakage
-%python% -c "import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 8) or sys.version_info[0] > 3)" || (
-	echo skipping Hy test -- not allowed on Python 3.8+ ^(yet!^) >&2
+%python% -c "import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 10) or sys.version_info[0] > 3 or sys.version_info[0] == 2)" || (
+	echo skipping Hy test -- not allowed on Python 2.x or 3.10+ ^(yet!^) >&2
 	rem cheaters gunna cheat
 	type expected-std-out.txt
 	exit /b 0
 )
 
-pip install -q "hy==0.17.0" || exit /b %errorlevel%
+rem ensure pip does not complain about a new version being available
+set PIP_DISABLE_PIP_VERSION_CHECK=1
+rem or that a new version will no longer work with this python version
+set PIP_NO_PYTHON_VERSION_WARNING=1
+pip install -q "hy==0.20.0" || exit /b %errorlevel%
 
 hy ./container.hy || exit /b %errorlevel%
 

+ 7 - 3
test/tests/python-hy/container.sh

@@ -16,13 +16,17 @@ fi
 
 # Hy is complicated, and uses Python's internal AST representation directly, and thus Hy releases usually lag behind a little on major Python releases (and we don't want that to gum up our tests)
 # see https://github.com/hylang/hy/issues/1111 for example breakage
-if ! "$python" -c 'import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 8) or sys.version_info[0] > 3)'; then
-	echo >&2 'skipping Hy test -- not allowed on Python 3.8+ (yet!)'
+if ! "$python" -c 'import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 10) or sys.version_info[0] > 3 or sys.version_info[0] == 2)'; then
+	echo >&2 'skipping Hy test -- not allowed on Python 2.x and 3.10+ (yet!)'
 	# cheaters gunna cheat
 	cat expected-std-out.txt
 	exit
 fi
 
-pip install -q 'hy==0.17.0'
+# ensure pip does not complain about a new version being available
+export PIP_DISABLE_PIP_VERSION_CHECK=1
+# or that a new version will no longer work with this python version
+export PIP_NO_PYTHON_VERSION_WARNING=1
+pip install -q 'hy==0.20.0'
 
 hy ./container.hy

+ 3 - 1
test/tests/rabbitmq-basics/run.sh

@@ -9,7 +9,9 @@ serverImage="$1"
 
 clientImage="$("$dir/../image-name.sh" librarytest/rabbitmq-basics "$serverImage")"
 "$dir/../docker-build.sh" "$dir" "$clientImage" <<EOD
-FROM python:3.7-alpine3.11
+FROM python:3.7-alpine
+# ensure pip does not complain about a new version being available
+ENV PIP_DISABLE_PIP_VERSION_CHECK=1
 RUN pip install pika==1.1.0
 COPY dir/*.py /usr/local/bin/
 EOD

+ 21 - 10
test/tests/run-python-in-container.sh

@@ -19,18 +19,29 @@ case "$1" in
 			echo >&2 'error: unable to determine how to run python'
 			exit 1
 		fi
-		source "$runDir/run-in-container.sh" "$testDir" "$1" "$python" container.py
+
+		# ensure pip does not complain about a new version being available
+		# or that a new version will no longer work with this python version
+		source "$runDir/run-in-container.sh" \
+			--docker-arg --env=PIP_DISABLE_PIP_VERSION_CHECK=1 \
+			--docker-arg --env=PIP_NO_PYTHON_VERSION_WARNING=1 \
+			"$testDir" "$1" "$python" container.py
 		;;
 
 	*)
-		source "$runDir/run-in-container.sh" "$testDir" "$1" sh -ec '
-			for c in pypy3 pypy python3 python; do
-				if [ -x "/usr/local/bin/$c" ]; then
-					exec "/usr/local/bin/$c" "$@"
-				fi
-			done
-			echo >&2 "error: unable to determine how to run python"
-			exit 1
-		' -- ./container.py
+		# ensure pip does not complain about a new version being available
+		# or that a new version will no longer work with this python version
+		source "$runDir/run-in-container.sh" \
+			--docker-arg --env=PIP_DISABLE_PIP_VERSION_CHECK=1 \
+			--docker-arg --env=PIP_NO_PYTHON_VERSION_WARNING=1 \
+			"$testDir" "$1" sh -ec '
+				for c in pypy3 pypy python3 python; do
+					if [ -x "/usr/local/bin/$c" ]; then
+						exec "/usr/local/bin/$c" "$@"
+					fi
+				done
+				echo >&2 "error: unable to determine how to run python"
+				exit 1
+			'  -- ./container.py
 		;;
 esac