git: 201f20199f7c - main - www/py-django-redis: Fix test suite

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Fri, 08 Dec 2023 09:50:31 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=201f20199f7c8c76483526cd09b50176f6dc02f2

commit 201f20199f7c8c76483526cd09b50176f6dc02f2
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2023-12-08 09:47:14 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2023-12-08 09:49:59 +0000

    www/py-django-redis: Fix test suite
    
    * When running the test suite it cannot find the "runtests.py" script as
      it has changed over time in newer versions.  Thus, make the test suite
      usable again and switch to USE_PYTHON=pytest.
    
    PR:             274790
    Approved by:    maintainer timeout (1+ month)
---
 www/py-django-redis/Makefile | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/www/py-django-redis/Makefile b/www/py-django-redis/Makefile
index 63080c8a8c83..81957ca9dc89 100644
--- a/www/py-django-redis/Makefile
+++ b/www/py-django-redis/Makefile
@@ -13,18 +13,25 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}django32>=3.2:www/py-django32@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}redis>=3.0.0:databases/py-redis@${PY_FLAVOR}
-TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}hiredis>=0:databases/py-hiredis@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}mock>=0:devel/py-mock@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}msgpack>=0:devel/py-msgpack@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}msgpack>=0:devel/py-msgpack@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-django>0:devel/py-pytest-django@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-mock>0:devel/py-pytest-mock@${PY_FLAVOR} \
+		redis-server:databases/redis
 
 USES=		python
-USE_PYTHON=	autoplist concurrent distutils
+USE_PYTHON=	autoplist concurrent distutils pytest
+
+# Required for Python +3.11 as the 'cgi' module is deprecated and slated for
+# removal in Python 3.13
+TEST_ARGS=	-W ignore::DeprecationWarning
+
+TEST_ENV=	DJANGO_SETTINGS_MODULE=settings.sqlite \
+		PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 
 CONFLICTS_INSTALL=	${PYTHON_PKGNAMEPREFIX}*${PORTNAME}
 
 NO_ARCH=	yes
 
-do-test:
-	@cd ${WRKSRC}/tests && ${PYTHON_CMD} runtests.py
+TEST_WRKSRC=	${WRKSRC}/tests
 
 .include <bsd.port.mk>