Skip to content

Commit 0fb301f

Browse files
committed
process
1 parent 1a11294 commit 0fb301f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tests/run_standalone_tests.sh

+15-9
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,27 @@ python -um pytest ${test_dir} -q --collect-only --pythonwarnings ignore 2>&1 > $
4444
# early terminate if collection failed (e.g. syntax error)
4545
if [[ $? != 0 ]]; then
4646
cat $COLLECTED_TESTS_FILE
47+
printf "ERROR: test collection failed!\n"
4748
exit 1
4849
fi
4950

50-
# removes the last line of the file
51-
sed -i '$d' $COLLECTED_TESTS_FILE
51+
# Initialize empty array
52+
tests=()
5253

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
5963

64+
# Count tests
6065
test_count=${#tests[@]}
61-
# present the collected tests
66+
67+
# Display results
6268
printf "collected $test_count tests:\n-------------------\n"
6369
printf "%s\n" "${tests[@]}"
6470
printf "\n===================\n"

0 commit comments

Comments
 (0)