@@ -35,43 +35,44 @@ if [ -f "./pytest.ini" ]; then
35
35
fi
36
36
fi
37
37
38
- echo " Finding test subdirectories in tests/ directory..."
38
+ echo " Finding all test_*.py files in tests/ directory..."
39
39
40
- # Find all subdirectories that contain test_*.py files
41
- ALL_TEST_DIRS=$( find tests/ -name " test_*.py" -type f -exec dirname {} \; | sort -u)
40
+ # Find all test_*.py files
41
+ ALL_TEST_FILES=$( find tests/ -name " test_*.py" -type f | sort)
42
+
43
+ # Filter out excluded files based on directory exclusions
44
+ TEST_FILES=" "
45
+ for test_file in $ALL_TEST_FILES ; do
46
+ exclude_file=false
47
+ test_dir=$( dirname " $test_file " )
42
48
43
- # Filter out excluded directories
44
- TEST_DIRS=" "
45
- for test_dir in $ALL_TEST_DIRS ; do
46
- exclude_dir=false
47
49
for excluded_dir in $EXCLUDED_DIRS ; do
48
50
excluded_dir=$( echo " $excluded_dir " | xargs) # trim whitespace
49
51
if [ -n " $excluded_dir " ]; then
50
- # Check if this directory should be excluded
52
+ # Check if this file's directory should be excluded
51
53
if [[ " $test_dir " == * " /$excluded_dir " ]] || [[ " $test_dir " == " tests/$excluded_dir " ]] || [[ " $test_dir " == * " /$excluded_dir /" * ]]; then
52
- exclude_dir =true
54
+ exclude_file =true
53
55
break
54
56
fi
55
57
fi
56
58
done
57
59
58
- if [ " $exclude_dir " = false ]; then
59
- TEST_DIRS =" $TEST_DIRS $test_dir "
60
+ if [ " $exclude_file " = false ]; then
61
+ TEST_FILES =" $TEST_FILES $test_file "
60
62
fi
61
63
done
62
64
63
65
# Clean up whitespace
64
- TEST_DIRS =$( echo " $TEST_DIRS " | xargs)
66
+ TEST_FILES =$( echo " $TEST_FILES " | xargs)
65
67
66
- if [ -z " $TEST_DIRS " ]; then
67
- echo " No test directories found in tests/ directory (after exclusions)"
68
+ if [ -z " $TEST_FILES " ]; then
69
+ echo " No test files found in tests/ directory (after exclusions)"
68
70
exit 1
69
71
fi
70
72
71
- echo " Found test directories:"
72
- for test_dir in $TEST_DIRS ; do
73
- test_count=$( find " $test_dir " -maxdepth 1 -name " test_*.py" -type f | wc -l)
74
- echo " $test_dir ($test_count test files)"
73
+ echo " Found test files:"
74
+ for test_file in $TEST_FILES ; do
75
+ echo " $test_file "
75
76
done
76
77
echo " "
77
78
@@ -84,81 +85,44 @@ if [ "$DRY_RUN" == "true" ]; then
84
85
echo " DRY RUN: Tests that would be executed"
85
86
echo " =========================================="
86
87
87
- for test_dir in $TEST_DIRS ; do
88
- if [ " $test_dir " == " tests/utils" ] || [ " $test_dir " == " tests/comm" ]; then
89
- # Run utils and comm tests individually for debugging
90
- echo " "
91
- echo " π NOTE: $test_dir will be run individually for debugging"
92
- test_files=$( find " $test_dir " -maxdepth 1 -name " test_*.py" -type f | sort)
93
- for test_file in $test_files ; do
94
- TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
95
- echo " $TOTAL_TESTS . pytest $test_file "
96
- done
97
- else
98
- # Run other directories as groups
99
- TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
100
- test_count=$( find " $test_dir " -maxdepth 1 -name " test_*.py" -type f | wc -l)
101
- echo " $TOTAL_TESTS . pytest $test_dir (contains $test_count test files)"
102
- fi
88
+ for test_file in $TEST_FILES ; do
89
+ TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
90
+ echo " $TOTAL_TESTS . pytest $PYTEST_FLAGS $test_file "
103
91
done
104
92
105
93
echo " "
106
94
echo " =========================================="
107
95
echo " DRY RUN SUMMARY"
108
96
echo " =========================================="
109
- echo " Total test commands that would be executed: $TOTAL_TESTS "
97
+ echo " Total test files that would be executed: $TOTAL_TESTS "
110
98
echo " "
111
99
echo " To actually run the tests, execute without --dry-run:"
112
100
echo " $0 "
113
101
echo " Or set DRY_RUN=false $0 "
114
102
else
115
- for test_dir in $TEST_DIRS ; do
116
- if [ " $test_dir " == " tests/utils" ] || [ " $test_dir " == " tests/comm" ]; then
117
- # Run utils and comm tests individually for debugging
118
- echo " =========================================="
119
- echo " Running $test_dir individually for debugging"
120
- echo " =========================================="
121
-
122
- test_files=$( find " $test_dir " -maxdepth 1 -name " test_*.py" -type f | sort)
123
- for test_file in $test_files ; do
124
- echo " Running: pytest $test_file "
125
- TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
126
-
127
- if pytest " $test_file " $PYTEST_FLAGS ; then
128
- echo " β
PASSED: $test_file "
129
- PASSED_TESTS=$(( PASSED_TESTS + 1 ))
130
- else
131
- echo " β FAILED: $test_file "
132
- FAILED_TESTS=" $FAILED_TESTS \n - $test_file "
133
- EXIT_CODE=1
134
- fi
135
- echo " "
136
- done
137
- else
138
- # Run other directories as groups
139
- echo " =========================================="
140
- echo " Running: pytest $test_dir "
141
- echo " =========================================="
142
-
143
- TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
144
-
145
- if pytest " $test_dir " $PYTEST_FLAGS ; then
146
- echo " β
PASSED: $test_dir "
147
- PASSED_TESTS=$(( PASSED_TESTS + 1 ))
148
- else
149
- echo " β FAILED: $test_dir "
150
- FAILED_TESTS=" $FAILED_TESTS \n - $test_dir "
151
- EXIT_CODE=1
152
- fi
103
+ for test_file in $TEST_FILES ; do
104
+ echo " =========================================="
105
+ echo " Running: pytest $PYTEST_FLAGS $test_file "
106
+ echo " =========================================="
153
107
154
- echo " "
108
+ TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
109
+
110
+ if pytest $PYTEST_FLAGS " $test_file " ; then
111
+ echo " β
PASSED: $test_file "
112
+ PASSED_TESTS=$(( PASSED_TESTS + 1 ))
113
+ else
114
+ echo " β FAILED: $test_file "
115
+ FAILED_TESTS=" $FAILED_TESTS \n - $test_file "
116
+ EXIT_CODE=1
155
117
fi
118
+
119
+ echo " "
156
120
done
157
121
158
122
echo " =========================================="
159
123
echo " TEST SUMMARY"
160
124
echo " =========================================="
161
- echo " Total test commands executed: $TOTAL_TESTS "
125
+ echo " Total test files executed: $TOTAL_TESTS "
162
126
echo " Passed: $PASSED_TESTS "
163
127
echo " Failed: $(( TOTAL_TESTS - PASSED_TESTS)) "
164
128
0 commit comments