Skip to content

Commit

Permalink
build-style/python3-module: prefer pytest in do_check
Browse files Browse the repository at this point in the history
Closes: #25052.
  • Loading branch information
ahesford committed Dec 9, 2020
1 parent 0efc6f1 commit a3227ff
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions common/build-style/python3-module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ do_build() {
}

do_check() {
if [ -z "$make_check_target" ]; then
if ! python3 setup.py --help test >/dev/null 2>&1; then
msg_warn "No command 'test' defined by setup.py.\n"
return 0
if python3 -m pytest --help >/dev/null 2>&1; then
python3 -m pytest ${make_check_args} ${make_check_target}
else
# Fall back to deprecated setup.py test orchestration without pytest
if [ -z "$make_check_target" ]; then
if ! python3 setup.py --help test >/dev/null 2>&1; then
msg_warn "No command 'test' defined by setup.py.\n"
return 0
fi
fi
fi

: ${make_check_target:=test}
python3 setup.py ${make_check_target} ${make_check_args}
: ${make_check_target:=test}
python3 setup.py ${make_check_target} ${make_check_args}
fi
}

do_install() {
Expand Down

0 comments on commit a3227ff

Please sign in to comment.