Skip to content

Commit 289bea7

Browse files
committed
add test
1 parent 0230206 commit 289bea7

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/py_zipapp/BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ sh_test(
9898
toolchains = ["//python:current_py_toolchain"],
9999
)
100100

101+
sh_test(
102+
name = "extract_root_test",
103+
srcs = ["extract_root_test.sh"],
104+
data = [
105+
":system_python_zipapp",
106+
],
107+
env = {
108+
"ZIPAPP": "$(rootpath :system_python_zipapp)",
109+
},
110+
)
111+
101112
py_library(
102113
name = "some_dep",
103114
srcs = ["some_dep.py"],
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
# Verify that the RULES_PYTHON_EXTRACT_ROOT env variable is respected.
3+
4+
set -euo pipefail
5+
6+
export RULES_PYTHON_EXTRACT_ROOT="${TEST_TMPDIR:-/tmp}/extract_root_test"
7+
8+
echo "Running zipapp the first time..."
9+
"$ZIPAPP"
10+
11+
# Verify that the directory was created
12+
if [[ ! -d "$RULES_PYTHON_EXTRACT_ROOT" ]]; then
13+
echo "Error: Extract root directory $RULES_PYTHON_EXTRACT_ROOT was not created!"
14+
exit 1
15+
fi
16+
17+
# Run a second time to ensure it can re-extract successfully.
18+
echo "Running zipapp the second time..."
19+
"$ZIPAPP"
20+
21+
echo "Success!"

0 commit comments

Comments
 (0)