Skip to content

Commit 594a16f

Browse files
committed
use pytest-skip plugin for selection in the test script
Removes --text-expr argument and replaces it with --select <name> Refactors --pdb pytest call into pytest-utils.sh Signed-off-by: Sławomir Błauciak <[email protected]>
1 parent 5c98bcc commit 594a16f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

scripts/pytest-utils.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ pytest() {
3838
pytest_extra_args+=(
3939
"--select-from-file=$TRITON_TEST_SELECTFILE"
4040
)
41+
elif [[ -n $TRITON_TEST_SELECT ]]; then
42+
pytest_extra_args+=(
43+
"--select-test=$TRITON_TEST_SELECT"
44+
)
45+
fi
46+
47+
if [[ $TRITON_TEST_DEBUG_FAIL = true ]]; then
48+
pytest_extra_args+=(
49+
"--pdb"
50+
)
4151
fi
4252

4353
if [[ ! -f $TRITON_TEST_SELECTFILE && -v TRITON_TEST_SUITE && -f $TRITON_TEST_SKIPLIST_DIR/$TRITON_TEST_SUITE.txt ]]; then

scripts/test-triton.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ OPTION:
4545
--skip-list SKIPLIST
4646
--extra-skip-list-suffixes SEMICOLON-SEPARATED LIST OF SUFFIXES
4747
--select-from-file SELECTFILE
48+
--select NAME
49+
--debug-fail
4850
"
4951

5052
err() {
@@ -86,6 +88,8 @@ TRITON_TEST_IGNORE_ERRORS=false
8688
SKIP_PIP=false
8789
SKIP_PYTORCH=false
8890
TEST_UNSKIP=false
91+
TRITON_TEST_SELECT=""
92+
TRITON_TEST_DEBUG_FAIL=false
8993

9094
while (( $# != 0 )); do
9195
case "$1" in
@@ -273,6 +277,14 @@ while (( $# != 0 )); do
273277
TRITON_TEST_SELECTFILE="$(realpath "$2")"
274278
shift 2
275279
;;
280+
--select)
281+
TRITON_TEST_SELECT="$2"
282+
shift 2
283+
;;
284+
--debug-fail)
285+
TRITON_TEST_DEBUG_FAIL=true
286+
shift
287+
;;
276288
--help)
277289
echo "$HELP"
278290
exit 0
@@ -342,7 +354,7 @@ run_unit_tests() {
342354
}
343355

344356
run_pytest_command() {
345-
if [[ -n "$TRITON_TEST_SELECTFILE" ]]; then
357+
if [[ -n "$TRITON_TEST_SELECTFILE" ]] || [[ -n "$TRITON_TEST_SELECT" ]]; then
346358
if pytest "$@" --collect-only > /dev/null 2>&1; then
347359
pytest "$@"
348360
fi

0 commit comments

Comments
 (0)