From 4efff12453cf3c9ae3695a6d46ae0df115343514 Mon Sep 17 00:00:00 2001 From: George Harker Date: Tue, 10 Dec 2024 13:59:57 -0800 Subject: [PATCH] tentative GH CI fixes remove python env var post #172 merge ensure pytest runs even when installed as pytest --- Makefile | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0801e3e..63886b0 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,11 @@ GEN=$(CABAL) new-run --minimize-conflict-set -j$(NCPUS) exe:xcffibgen -- VENV=xcffib_venv PYTHON=$(VENV)/bin/python3 FLAKE=$(VENV)/bin/flake8 +PYTEST=pytest-3 +ifeq (, $(shell which $(PYTEST))) + PYTEST=pytest +endif + # you should have xcb-proto installed to run this xcffib: module/*.py xcffib.cabal $(shell find . -path ./test -prune -false -o -name \*.hs) @@ -46,7 +51,7 @@ clean: -rm -rf .pc cabal.project.local* valgrind: xcffib - valgrind --leak-check=full --show-leak-kinds=definite pytest-3 -v + valgrind --leak-check=full --show-leak-kinds=definite $(PYTEST) -v newtests: $(GEN) --input ./test/generator/ --output ./test/generator/ @@ -62,12 +67,38 @@ htests: $(CABAL) new-test -j$(NCPUS) --enable-tests $(VENV): requirements.txt - # the python in $PATH in CI is the python from the matrix, so it is the - # "right" python to start with - python3 -m venv $(VENV) - $(PYTHON) -m pip install -r requirements.txt + # the python in $PATH in CI is the python from the matrix, so it is the + # "right" python to start with + python -m venv $(VENV) + $(PYTHON) -m pip install -r requirements.txt + +check-abi: + # check abi precompiled mode + # make a temporary env to test install and ensure we cd somewhere + # we won't pick up the local source xcffib module + $(eval TMPLOC=$(shell mktemp -d)) + python -m venv $(TMPLOC) + CC=/bin/false ${TMPLOC}/bin/python -m pip install -v . + ${TMPLOC}/bin/python -m pip install pytest pytest-xdist + pushd ${TMPLOC} && \ + ${TMPLOC}/bin/python -c "import xcffib; assert xcffib.cffi_mode == 'abi_precompiled'" && \ + popd + ${TMPLOC}/bin/python -m pytest -v --durations=3 -n auto + +check-api: + # check abi precompiled mode + # make a temporary env to test install and ensure we cd somewhere + # we won't pick up the local source xcffib module + $(eval TMPLOC=$(shell mktemp -d)) + python -m venv ${TMPLOC} + ${TMPLOC}/bin/python -m pip install -v . + ${TMPLOC}/bin/python -m pip install pytest pytest-xdist + pushd ${TMPLOC} && \ + ${TMPLOC}/bin/python -c "import xcffib; assert xcffib.cffi_mode == 'abi_precompiled'" && \ + popd + ${TMPLOC}/bin/python -m pytest -v --durations=3 -n auto \ -check: xcffib htests $(VENV) lint +check: xcffib htests $(VENV) lint check-api check-abi cabal check $(PYTHON) -m compileall xcffib $(PYTHON) -m pytest -v --durations=3 -n $(NCPUS)