Skip to content

Commit 180fd0e

Browse files
Fix unit tests
1 parent 920e51d commit 180fd0e

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tests/unittest.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ one_test() {
6464
# Desktop execution
6565
if [ $is_graphical -eq 1 ]; then
6666
echo "Graphical test: include main.py"
67-
"$binary" -X heapsize=8M -c "import sys ; sys.path.insert(0, 'lib') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py) ; sys.path.append(\"$tests_abs_path\")
67+
"$binary" -X heapsize=8M -c "import sys ; sys.path.insert(0, 'lib') ; sys.path.append(\"$tests_abs_path\") ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
6868
$(cat $file)
6969
result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
70-
result=$?
70+
result=$?
7171
else
7272
echo "Regular test: no boot files"
73-
"$binary" -X heapsize=8M -c "import sys ; sys.path.insert(0, 'lib') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
73+
"$binary" -X heapsize=8M -c "import sys ; sys.path.insert(0, 'lib') ; sys.path.append(\"$tests_abs_path\") ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
7474
$(cat $file)
7575
result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
76-
result=$?
76+
result=$?
7777
fi
7878
else
7979
if [ ! -z "$ondevice" ]; then
@@ -90,23 +90,23 @@ result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
9090
echo "$test logging to $testlog"
9191
if [ $is_graphical -eq 1 ]; then
9292
# Graphical test: system already initialized, just add test paths
93-
"$mpremote" exec "import sys ; sys.path.insert(0, 'lib') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py) ; sys.path.append('tests')
93+
"$mpremote" exec "import sys ; sys.path.insert(0, 'lib') ; sys.path.append('tests') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
9494
$(cat $file)
9595
result = unittest.main()
9696
if result.wasSuccessful():
97-
print('TEST WAS A SUCCESS')
97+
print('TEST WAS A SUCCESS')
9898
else:
99-
print('TEST WAS A FAILURE')
99+
print('TEST WAS A FAILURE')
100100
" | tee "$testlog"
101101
else
102102
# Regular test: no boot files
103-
"$mpremote" exec "import sys ; sys.path.insert(0, 'lib') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
103+
"$mpremote" exec "import sys ; sys.path.insert(0, 'lib') ; sys.path.append('tests') ; import mpos ; mpos.TaskManager.disable() ; $(cat main.py)
104104
$(cat $file)
105105
result = unittest.main()
106106
if result.wasSuccessful():
107-
print('TEST WAS A SUCCESS')
107+
print('TEST WAS A SUCCESS')
108108
else:
109-
print('TEST WAS A FAILURE')
109+
print('TEST WAS A FAILURE')
110110
" | tee "$testlog"
111111
fi
112112
grep -q "TEST WAS A SUCCESS" "$testlog"

0 commit comments

Comments
 (0)