Skip to content

Commit 766f046

Browse files
committed
Expose Python debugger option for failed tests
Enables automatic running for Python debug for failed tests
1 parent 2ae600a commit 766f046

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/test-triton.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ OPTION:
4646
--extra-skip-list-suffixes SEMICOLON-SEPARATED LIST OF SUFFIXES
4747
--select-from-file SELECTFILE
4848
--test-expr EXPRESSION
49+
--debug-fail
4950
"
5051

5152
err() {
@@ -88,6 +89,7 @@ SKIP_PIP=false
8889
SKIP_PYTORCH=false
8990
TEST_UNSKIP=false
9091
TEST_FILTER_EXPRESSION=""
92+
TEST_DEBUG_FAIL=false
9193

9294
while (( $# != 0 )); do
9395
case "$1" in
@@ -279,6 +281,10 @@ while (( $# != 0 )); do
279281
TEST_FILTER_EXPRESSION="$2"
280282
shift 2
281283
;;
284+
--debug-fail)
285+
TEST_DEBUG_FAIL=true
286+
shift
287+
;;
282288
--help)
283289
echo "$HELP"
284290
exit 0
@@ -376,6 +382,10 @@ run_pytest_command() {
376382
pytest_args+=("-k" "$pytest_expr")
377383
fi
378384

385+
if [[ "$TEST_DEBUG_FAIL" == true ]]; then
386+
pytest_args+=("--pdb")
387+
fi
388+
379389
if [[ -n "$TRITON_TEST_SELECTFILE" ]] || [[ -n "$pytest_expr" ]]; then
380390
if pytest "${pytest_args[@]}" --collect-only > /dev/null 2>&1; then
381391
pytest "${pytest_args[@]}"

0 commit comments

Comments
 (0)