@@ -6,31 +6,34 @@ RED="\033[31;1m"
66MAGENTA=" \033[35m"
77NORMAL=" \033[0m"
88
9- prun () { echo -e " \n$RED \$ $@ $NORMAL \n" ; " $@ " ; }
9+ ptest () { echo -e " \n${MAGENTA} [TEST] $@ ${NORMAL} \n" ; }
10+ prun () { echo -e " $RED \$ $@ $NORMAL " ; " $@ " ; }
1011
1112prun cd example_pkg
1213
14+ ptest version command runs
1315prun spin --version
1416
17+ ptest build command runs
1518pip install meson-python ninja
1619prun spin build
1720
18- # Test spin run
21+ ptest Does spin expand \$ PYTHONPATH ?
1922SPIN_PYTHONPATH=$( spin run ' echo $PYTHONPATH' )
2023echo spin sees PYTHONPATH=\" ${SPIN_PYTHONPATH} \"
2124if [[ ${SPIN_PYTHONPATH} == " \$ PYTHONPATH" ]]; then
2225 echo " Expected Python path, but got $SPIN_PYTHONPATH instead"
2326 exit 1
2427fi
2528
26- echo -e " ${MAGENTA} Does \$ PYTHONPATH contains site-packages?${NORMAL} "
29+ ptest Does \$ PYTHONPATH contains site-packages?
2730if [[ ${SPIN_PYTHONPATH} == * " site-packages" ]]; then
2831 echo " Yes"
2932else
3033 echo " No; it is $SPIN_PYTHONPATH "
3134fi
3235
33- echo -e " ${MAGENTA} Does \` spin run\` redirect only command output to stdout?${NORMAL} "
36+ ptest Does \` spin run\` redirect only command output to stdout?
3437# Once we're on Python >3.11, can replace syspath manipulation below with -P flag to Python
3538VERSION=$( spin run python -c ' import sys; del sys.path[0]; import example_pkg; print(example_pkg.__version__)' )
3639if [[ $VERSION == " 0.0.0dev0" ]]; then
4043 exit 1
4144fi
4245
46+ ptest Does spin detect conflict with editable install?
47+ prun pip install --quiet -e .
48+ OUT=$( spin run ls)
49+ if [[ $OUT == * " Warning! An editable installation" * ]]; then
50+ echo " Yes"
51+ else
52+ echo " No"
53+ exit 1
54+ fi
55+ prun pip uninstall --quiet -y example_pkg
56+
4357if [[ $PLATFORM == linux || $PLATFORM == darwin ]]; then
4458 # Detecting whether a file is executable is not that easy on Windows,
4559 # as it seems to take into consideration whether that file is associated as an executable.
46- echo -e " ${MAGENTA} Does \` spin run foo.py\` warn that \` spin run python foo.py\` is correct? ${NORMAL} "
60+ ptest Does \` spin run foo.py\` warn that \` spin run python foo.py\` is likely intended ?
4761 OUT=$( touch __foo.py && spin run __foo.py || true )
4862 rm __foo.py
4963 if [[ $OUT == * " Did you mean to call" * ]]; then
@@ -54,28 +68,34 @@ if [[ $PLATFORM == linux || $PLATFORM == darwin ]]; then
5468 fi
5569fi
5670
71+ ptest test command runs
5772prun spin test
58- echo -e " ${MAGENTA} Running \` spin test\` , but with PYTHONPATH set${NORMAL} "
73+
74+ ptest Does \` spin test\` work when PYTHONPATH is set?
5975PYTHONPATH=./tmp spin test
6076
77+ ptest sdist command runs
6178prun spin sdist
79+
80+ ptest example command runs
6281prun spin example
6382
64- pip install sphinx
83+ ptest docs command runs
84+ pip install --quiet sphinx
6585prun spin docs
6686
87+ ptest install command works
88+ prun spin install
89+ (cd /tmp ; [[ $( python -c ' import example_pkg; print(example_pkg.__version__)' ) == " 0.0.0dev0" ]])
90+ prun pip uninstall -y --quiet example_pkg
6791
6892# # Platform specialized tests
6993
7094if [[ $PLATFORM == linux ]]; then
95+ ptest gdb command runs on linux
7196 prun spin gdb -c ' import example_pkg; example_pkg.echo("hi")' -- --eval " run" --batch
7297fi
7398
7499# if [[ $PLATFORM == darwin ]]; then
75100
76101# if [[ $PLATFORM =~ ^win.* ]]; then
77-
78-
79- prun spin install
80- cd /tmp
81- python -c ' import example_pkg; print(example_pkg.__version__)'
0 commit comments