@@ -6,31 +6,34 @@ RED="\033[31;1m"
6
6
MAGENTA=" \033[35m"
7
7
NORMAL=" \033[0m"
8
8
9
- prun () { echo -e " \n$RED \$ $@ $NORMAL \n" ; " $@ " ; }
9
+ ptest () { echo -e " \n${MAGENTA} [TEST] $@ ${NORMAL} \n" ; }
10
+ prun () { echo -e " $RED \$ $@ $NORMAL " ; " $@ " ; }
10
11
11
12
prun cd example_pkg
12
13
14
+ ptest version command runs
13
15
prun spin --version
14
16
17
+ ptest build command runs
15
18
pip install meson-python ninja
16
19
prun spin build
17
20
18
- # Test spin run
21
+ ptest Does spin expand \$ PYTHONPATH ?
19
22
SPIN_PYTHONPATH=$( spin run ' echo $PYTHONPATH' )
20
23
echo spin sees PYTHONPATH=\" ${SPIN_PYTHONPATH} \"
21
24
if [[ ${SPIN_PYTHONPATH} == " \$ PYTHONPATH" ]]; then
22
25
echo " Expected Python path, but got $SPIN_PYTHONPATH instead"
23
26
exit 1
24
27
fi
25
28
26
- echo -e " ${MAGENTA} Does \$ PYTHONPATH contains site-packages?${NORMAL} "
29
+ ptest Does \$ PYTHONPATH contains site-packages?
27
30
if [[ ${SPIN_PYTHONPATH} == * " site-packages" ]]; then
28
31
echo " Yes"
29
32
else
30
33
echo " No; it is $SPIN_PYTHONPATH "
31
34
fi
32
35
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?
34
37
# Once we're on Python >3.11, can replace syspath manipulation below with -P flag to Python
35
38
VERSION=$( spin run python -c ' import sys; del sys.path[0]; import example_pkg; print(example_pkg.__version__)' )
36
39
if [[ $VERSION == " 0.0.0dev0" ]]; then
40
43
exit 1
41
44
fi
42
45
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
+
43
57
if [[ $PLATFORM == linux || $PLATFORM == darwin ]]; then
44
58
# Detecting whether a file is executable is not that easy on Windows,
45
59
# 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 ?
47
61
OUT=$( touch __foo.py && spin run __foo.py || true )
48
62
rm __foo.py
49
63
if [[ $OUT == * " Did you mean to call" * ]]; then
@@ -54,28 +68,34 @@ if [[ $PLATFORM == linux || $PLATFORM == darwin ]]; then
54
68
fi
55
69
fi
56
70
71
+ ptest test command runs
57
72
prun 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?
59
75
PYTHONPATH=./tmp spin test
60
76
77
+ ptest sdist command runs
61
78
prun spin sdist
79
+
80
+ ptest example command runs
62
81
prun spin example
63
82
64
- pip install sphinx
83
+ ptest docs command runs
84
+ pip install --quiet sphinx
65
85
prun spin docs
66
86
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
67
91
68
92
# # Platform specialized tests
69
93
70
94
if [[ $PLATFORM == linux ]]; then
95
+ ptest gdb command runs on linux
71
96
prun spin gdb -c ' import example_pkg; example_pkg.echo("hi")' -- --eval " run" --batch
72
97
fi
73
98
74
99
# if [[ $PLATFORM == darwin ]]; then
75
100
76
101
# 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