build-style/python3-module: prefer pytest in do_check

Closes: #25052.
This commit is contained in:
Andrew J. Hesford 2020-12-02 22:22:31 -05:00
parent 0efc6f1482
commit a3227ffb48
1 changed files with 12 additions and 7 deletions

View File

@ -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() {