Commit 0fb301f 1 parent 1a11294 commit 0fb301f Copy full SHA for 0fb301f
File tree 1 file changed +15
-9
lines changed
1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -44,21 +44,27 @@ python -um pytest ${test_dir} -q --collect-only --pythonwarnings ignore 2>&1 > $
44
44
# early terminate if collection failed (e.g. syntax error)
45
45
if [[ $? != 0 ]]; then
46
46
cat $COLLECTED_TESTS_FILE
47
+ printf " ERROR: test collection failed!\n"
47
48
exit 1
48
49
fi
49
50
50
- # removes the last line of the file
51
- sed -i ' $d ' $COLLECTED_TESTS_FILE
51
+ # Initialize empty array
52
+ tests=()
52
53
53
- # Get test list and run each test individually
54
- tests=($( grep -oP ' \S+::test_\S+' " $COLLECTED_TESTS_FILE " ) )
55
- # remove everything before "$test_dir/" in each array element
56
- for i in " ${! tests[@]} " ; do
57
- tests[$i ]=${tests[$i]#* ${test_dir} / }
58
- done
54
+ # Read from file line by line
55
+ while IFS= read -r line; do
56
+ # Only keep lines containing "test_"
57
+ if [[ $line == * " test_" * ]]; then
58
+ # Extract part after test_dir/
59
+ pruned_line=" ${line#* ${test_dir} / } "
60
+ tests+=(" ${test_dir} /$pruned_line " )
61
+ fi
62
+ done < $COLLECTED_TESTS_FILE
59
63
64
+ # Count tests
60
65
test_count=${# tests[@]}
61
- # present the collected tests
66
+
67
+ # Display results
62
68
printf " collected $test_count tests:\n-------------------\n"
63
69
printf " %s\n" " ${tests[@]} "
64
70
printf " \n===================\n"
You can’t perform that action at this time.
0 commit comments