Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/multi_python_versions/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ py_test(
data = [":version_3_10"],
env = {
"SUBPROCESS_VERSION_CHECK": "3.10",
"SUBPROCESS_VERSION_PY_BINARY": "$(rootpath :version_3_10)",
"SUBPROCESS_VERSION_PY_BINARY": "$(rootpaths :version_3_10)",
"VERSION_CHECK": "3.9",
},
main = "cross_version_test.py",
Expand All @@ -143,7 +143,7 @@ py_test_3_10(
data = [":version_3_9"],
env = {
"SUBPROCESS_VERSION_CHECK": "3.9",
"SUBPROCESS_VERSION_PY_BINARY": "$(rootpath :version_3_9)",
"SUBPROCESS_VERSION_PY_BINARY": "$(rootpaths :version_3_9)",
"VERSION_CHECK": "3.10",
},
main = "cross_version_test.py",
Expand All @@ -155,7 +155,7 @@ sh_test(
data = [":version_default"],
env = {
"VERSION_CHECK": "3.9", # The default defined in the WORKSPACE.
"VERSION_PY_BINARY": "$(rootpath :version_default)",
"VERSION_PY_BINARY": "$(rootpaths :version_default)",
},
)

Expand All @@ -165,7 +165,7 @@ sh_test(
data = [":version_3_8"],
env = {
"VERSION_CHECK": "3.8",
"VERSION_PY_BINARY": "$(rootpath :version_3_8)",
"VERSION_PY_BINARY": "$(rootpaths :version_3_8)",
},
)

Expand All @@ -175,7 +175,7 @@ sh_test(
data = [":version_3_9"],
env = {
"VERSION_CHECK": "3.9",
"VERSION_PY_BINARY": "$(rootpath :version_3_9)",
"VERSION_PY_BINARY": "$(rootpaths :version_3_9)",
},
)

Expand All @@ -185,7 +185,7 @@ sh_test(
data = [":version_3_10"],
env = {
"VERSION_CHECK": "3.10",
"VERSION_PY_BINARY": "$(rootpath :version_3_10)",
"VERSION_PY_BINARY": "$(rootpaths :version_3_10)",
},
)

Expand Down
6 changes: 5 additions & 1 deletion examples/multi_python_versions/tests/version_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@

set -o errexit -o nounset -o pipefail

version_py_binary=$("${VERSION_PY_BINARY}")
# VERSION_PY_BINARY is a space separate list of the executable and its main
# py file. We just want the executable.
bin=($VERSION_PY_BINARY)
bin="${bin[@]//*.py}"
version_py_binary=$($bin)

if [[ "${version_py_binary}" != "${VERSION_CHECK}" ]]; then
echo >&2 "expected version '${VERSION_CHECK}' is different than returned '${version_py_binary}'"
Expand Down