Summary
The hypothesis-test target in .rhiza/make.d/test.mk fails with make exit code 2 when no hypothesis/property tests are found, because pytest exits with code 5 ("no tests collected") which is not handled.
History
This was previously fixed in downstream repos (e.g. commit 000589f in tschm/jquantstats: "Handle pytest exit code 5 in hypothesis-test target"), but the fix was removed by the rhiza sync in commit ff19245 ("sync").
Affected template file
.rhiza/make.d/test.mk — the hypothesis-test:: target
Current behaviour
============================ 96 deselected in 1.64s ============================
make: *** [.rhiza/make.d/test.mk:104: hypothesis-test] Error 5
Error: Process completed with exit code 2.
Pytest exit code 5 means no tests were collected, which is expected for projects that use the hypothesis or property marker but have no such tests yet.
Expected behaviour
When pytest exits with code 5, the target should print a warning and exit cleanly (code 0), matching the same pattern already used for the early-exit check at the top of the target.
Fix
Capture the exit code and treat 5 as a warning:
PYTEST_HTML_TITLE="Hypothesis tests" ${UV_BIN} run pytest \
--ignore=${TESTS_FOLDER}/benchmarks \
-v \
--hypothesis-show-statistics \
--hypothesis-seed=0 \
-m "hypothesis or property" \
--tb=short \
--html=_tests/hypothesis/report.html; \
code=$$?; \
if [ $$code -eq 5 ]; then \
printf "${YELLOW}[WARN] No hypothesis/property tests found, skipping.${RESET}\n"; \
exit 0; \
fi; \
exit $$code
This is the same pattern that was previously in the template and was inadvertently dropped.
Summary
The
hypothesis-testtarget in.rhiza/make.d/test.mkfails withmakeexit code 2 when no hypothesis/property tests are found, because pytest exits with code 5 ("no tests collected") which is not handled.History
This was previously fixed in downstream repos (e.g. commit
000589fin tschm/jquantstats: "Handle pytest exit code 5 in hypothesis-test target"), but the fix was removed by the rhiza sync in commitff19245("sync").Affected template file
.rhiza/make.d/test.mk— thehypothesis-test::targetCurrent behaviour
Pytest exit code 5 means no tests were collected, which is expected for projects that use the
hypothesis or propertymarker but have no such tests yet.Expected behaviour
When pytest exits with code 5, the target should print a warning and exit cleanly (code 0), matching the same pattern already used for the early-exit check at the top of the target.
Fix
Capture the exit code and treat 5 as a warning:
This is the same pattern that was previously in the template and was inadvertently dropped.