Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c451b9

Browse files
author
Takashi Matsuo
committed
don't rely on git, remove noxfile.py only if we copied it
1 parent 2754611 commit 1c451b9

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

.kokoro/tests/run_tests.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,16 @@ for file in **/requirements.txt; do
136136

137137
# If no local noxfile exists, copy the one from root
138138
if [[ ! -f "noxfile.py" ]]; then
139-
PARENT_DIR=$(cd ../ && pwd)
140-
while [[ "$PARENT_DIR" != "$ROOT" && ! -f "$PARENT_DIR/noxfile-template.py" ]];
141-
do
142-
PARENT_DIR=$(dirname "$PARENT_DIR")
143-
done
144-
cp "$PARENT_DIR/noxfile-template.py" "./noxfile.py"
145-
echo -e "\n Using noxfile-template from parent folder ($PARENT_DIR). \n"
139+
PARENT_DIR=$(cd ../ && pwd)
140+
while [[ "$PARENT_DIR" != "$ROOT" && ! -f "$PARENT_DIR/noxfile-template.py" ]];
141+
do
142+
PARENT_DIR=$(dirname "$PARENT_DIR")
143+
done
144+
cp "$PARENT_DIR/noxfile-template.py" "./noxfile.py"
145+
echo -e "\n Using noxfile-template from parent folder ($PARENT_DIR). \n"
146+
cleanup_noxfile=1
147+
else
148+
cleanup_noxfile=0
146149
fi
147150

148151
# Use nox to execute the tests for the project.
@@ -165,8 +168,10 @@ for file in **/requirements.txt; do
165168
echo -e "\n Testing completed.\n"
166169
fi
167170

168-
# Remove noxfile.py if it's not tracked by git.
169-
git ls-files --error-unmatch noxfile.py > /dev/null 2>&1 | rm noxfile.py
171+
# Remove noxfile.py if we copied.
172+
if [[ $cleanup_noxfile -eq 1 ]]; then
173+
rm noxfile.py
174+
fi
170175

171176
done
172177
cd "$ROOT"

0 commit comments

Comments
 (0)