Skip to content

Commit 4bc4a44

Browse files
reyoungemailweixu
authored andcommitted
Check if paddle is installed when unittest. (#134)
1 parent 98d9b34 commit 4bc4a44

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

paddle/.set_python_path.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@
2222
# It same as PYTHONPATH=${YOUR_PYTHON_PATH}:$PYTHONPATH {exec...}
2323
#
2424

25-
PYPATH=""
26-
set -x
27-
while getopts "d:" opt; do
28-
case $opt in
29-
d)
30-
PYPATH=$OPTARG
31-
;;
32-
esac
33-
done
34-
shift $(($OPTIND - 1))
35-
export PYTHONPATH=$PYPATH
36-
$@
25+
if ! python -c "import paddle" >/dev/null 2>/dev/null; then
26+
PYPATH=""
27+
set -x
28+
while getopts "d:" opt; do
29+
case $opt in
30+
d)
31+
PYPATH=$OPTARG
32+
;;
33+
esac
34+
done
35+
shift $(($OPTIND - 1))
36+
export PYTHONPATH=$PYPATH
37+
$@
38+
else
39+
echo "paddle package is already in your PYTHONPATH. But unittest need a clean environment."
40+
echo "Please uninstall paddle package before start unittest. Try to 'pip uninstall paddle'"
41+
exit 1
42+
fi

0 commit comments

Comments
 (0)