jw-pkg/make/py-run.mk
Jan Lindemann 52f34a915d
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>
2026-07-02 19:52:35 +02:00

25 lines
581 B
Makefile

include $(JWBDIR)/make/defs.mk
include $(JWBDIR)/make/py-defs.mk
#include $(JWBDIR)/make/scripts-targets.mk
#include $(JWBDIR)/make/rules.mk
EXE ?= $(firstword $(wildcard main.py runme.py test.py *.py))
EXE_ARGS ?=
PYTHON_RUNNER ?= $(PYTHON)
all:
install:
clean:
distclean:
test: all
run:
$(PYTHON_RUNNER) $(EXE) $(EXE_ARGS)
run.sh:
echo -e "#!/bin/bash\n\nexport PYTHONPATH=$(PYTHONPATH)\nset -x\nexec $(PYTHON) $(EXE)" '"$$@"' > $@.tmp
chmod 755 $@.tmp
mv $@.tmp $@
clean-run-sh:
rm -f run.sh
clean: clean-run-sh