From a64253b6ab9647819c4581c9934b8d06870d53c7 Mon Sep 17 00:00:00 2001 From: jbeich Date: Mon, 18 Jul 2016 16:15:01 +0000 Subject: Invoke pytest from within desired python version When testing a port for a non-default python py.test may fail to find dependencies for default version because they weren't built e.g., $ make test PYTHON_VERSION=python3.5 -C devel/py-apscheduler [...] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/_pytest/config.py", line 319, in _importconftest mod = conftestpath.pyimport() File "/usr/local/lib/python3.5/site-packages/py/_path/local.py", line 650, in pyimport __import__(modname) File "/usr/ports/devel/py-apscheduler/work/APScheduler-3.2.0/tests/conftest.py", line 8, in from apscheduler.job import Job File "/usr/ports/devel/py-apscheduler/work/APScheduler-3.2.0/apscheduler/job.py", line 4, in import six ImportError: No module named 'six' ERROR: could not load /usr/ports/devel/py-apscheduler/work/APScheduler-3.2.0/tests/conftest.py Approved by: portmgr blanket --- databases/py-sqlalchemy09/Makefile | 2 +- databases/py-sqlalchemy10/Makefile | 2 +- devel/py-apscheduler/Makefile | 2 +- devel/py-cffi/Makefile | 5 +++-- devel/py-pytest-xdist/Makefile | 2 +- sysutils/py-honcho/Makefile | 2 +- textproc/py-pyscss/Makefile | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/databases/py-sqlalchemy09/Makefile b/databases/py-sqlalchemy09/Makefile index 8a33a019944..165f2dfe5e7 100644 --- a/databases/py-sqlalchemy09/Makefile +++ b/databases/py-sqlalchemy09/Makefile @@ -76,6 +76,6 @@ do-test: .if ${PYTHON_REL} >= 3000 ${PY2TO3_CMD} ${PY2TO3_ARGS} ${WRKSRC}/test .endif - @cd ${WRKSRC} && py.test + @(cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/databases/py-sqlalchemy10/Makefile b/databases/py-sqlalchemy10/Makefile index 6b7afc06e92..a8970c1dd0c 100644 --- a/databases/py-sqlalchemy10/Makefile +++ b/databases/py-sqlalchemy10/Makefile @@ -76,6 +76,6 @@ do-test: .if ${PYTHON_REL} >= 3000 ${PY2TO3_CMD} ${PY2TO3_ARGS} ${WRKSRC}/test .endif - @cd ${WRKSRC} && py.test + @(cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/devel/py-apscheduler/Makefile b/devel/py-apscheduler/Makefile index 70a9dd972b7..acbd4e84579 100644 --- a/devel/py-apscheduler/Makefile +++ b/devel/py-apscheduler/Makefile @@ -43,6 +43,6 @@ post-patch: ${WRKSRC}/tests/test_schedulers.py do-test: - @(cd ${TEST_WRKSRC}; ${SETENV} ${TEST_ENV} py.test) + @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/devel/py-cffi/Makefile b/devel/py-cffi/Makefile index 3ff199674ae..178813b626c 100644 --- a/devel/py-cffi/Makefile +++ b/devel/py-cffi/Makefile @@ -24,7 +24,8 @@ USES= python USE_PYTHON= autoplist distutils do-test: patch - cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} build_ext -i && \ - ${LOCALBASE}/bin/py.test + @(cd ${TEST_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} \ + ${PYDISTUTILS_SETUP} build_ext -i) + @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/devel/py-pytest-xdist/Makefile b/devel/py-pytest-xdist/Makefile index 8133b2efedd..97300d6eef3 100644 --- a/devel/py-pytest-xdist/Makefile +++ b/devel/py-pytest-xdist/Makefile @@ -29,6 +29,6 @@ post-extract: ${RM} -rf ${WRKSRC}/testing/__pycache__ do-test: - @cd ${WRKSRC} && py.test + @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/sysutils/py-honcho/Makefile b/sysutils/py-honcho/Makefile index 313c48518f6..27c05a4c574 100644 --- a/sysutils/py-honcho/Makefile +++ b/sysutils/py-honcho/Makefile @@ -22,6 +22,6 @@ USES= python USE_PYTHON= autoplist distutils regression-test: - @cd ${WRKSRC} && py.test + @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include diff --git a/textproc/py-pyscss/Makefile b/textproc/py-pyscss/Makefile index f75fbd9c07e..7ebd95a189e 100644 --- a/textproc/py-pyscss/Makefile +++ b/textproc/py-pyscss/Makefile @@ -27,6 +27,6 @@ USES= python USE_PYTHON= distutils autoplist regression-test: build - @cd ${WRKSRC} && py.test + @(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest) .include -- cgit