NO_TEST, do-test: and TEST_DEPENDS?

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sat, 21 May 2022 14:37:45 UTC
Hi,

I just grabbed a random example and made put the NO_TEST into the Makefile to make things clear.

What is the proper way to
 	(1) disable tests
and more important
 	(2) to amke sure the TEST_DEPENDS and not build in these cases?

While I can iterate on port after port and apply a change like the below it feels utterly wrong and it seems I am doing something silly here which has a proper knob I cannot find?

Lots of health,
Bjoern


diff --git a/devel/py-pytest/Makefile b/devel/py-pytest/Makefile
index c6a021939322..9b221c0d8742 100644
--- a/devel/py-pytest/Makefile
+++ b/devel/py-pytest/Makefile
@@ -18,6 +18,9 @@ RUN_DEPENDS=  ${PYTHON_PKGNAMEPREFIX}attrs>=19.2.0:devel/py-attrs@${PY_FLAVOR} \
                 ${PYTHON_PKGNAMEPREFIX}pluggy>=0.12<2.0:devel/py-pluggy@${PY_FLAVOR} \
                 ${PYTHON_PKGNAMEPREFIX}py>=1.8.2:devel/py-py@${PY_FLAVOR} \
                 ${PYTHON_PKGNAMEPREFIX}tomli>=1.0.0:textproc/py-tomli@${PY_FLAVOR}
+
+NO_TEST=
+.if !defined(NO_TEST)
  TEST_DEPENDS=  bash:shells/bash \
                 lsof:sysutils/lsof \
                 ${PYTHON_PKGNAMEPREFIX}argcomplete>=0:devel/py-argcomplete@${PY_FLAVOR} \
@@ -34,6 +37,7 @@ TEST_DEPENDS= bash:shells/bash \
                 ${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
                 ${PYTHON_PKGNAMEPREFIX}twisted>=0:devel/py-twisted@${PY_FLAVOR} \
                 ${PYTHON_PKGNAMEPREFIX}xmlschema>=0:textproc/py-xmlschema@${PY_FLAVOR}
+.endif

  USES=          python:3.7+
  USE_PYTHON=    autoplist concurrent distutils
@@ -49,7 +53,9 @@ RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=0.12:devel/py-importlib
  .endif

  # XXX: test_pdb_custom_cls_with_set_trace fails
+.if !defined(NO_TEST)
  do-test:
         cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs
+.endif

  .include <bsd.port.post.mk>


-- 
Bjoern A. Zeeb                                                     r15:7