py-test.mk: Add file

Add a dedicated py-test.mk for running tests with pytest instead of python.

The commit introduces a new variable PYTHON_RUNNER, which is then used by py-run.mk to do it's usual thing. Running pytest is similar enough to running Python programs to keep the rest of the machinery and prevent redundancy from creeping in.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-02 14:49:08 +02:00
commit 52f34a915d
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 8 additions and 1 deletions

View file

@ -5,6 +5,7 @@ include $(JWBDIR)/make/py-defs.mk
EXE ?= $(firstword $(wildcard main.py runme.py test.py *.py))
EXE_ARGS ?=
PYTHON_RUNNER ?= $(PYTHON)
all:
install:
@ -13,7 +14,7 @@ distclean:
test: all
run:
$(PYTHON) $(EXE) $(EXE_ARGS)
$(PYTHON_RUNNER) $(EXE) $(EXE_ARGS)
run.sh:
echo -e "#!/bin/bash\n\nexport PYTHONPATH=$(PYTHONPATH)\nset -x\nexec $(PYTHON) $(EXE)" '"$$@"' > $@.tmp

6
make/py-test.mk Normal file
View file

@ -0,0 +1,6 @@
PYTHON_RUNNER ?= pytest -v
include $(JWBDIR)/make/py-run.mk
all:
test: run