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 <module>
    from apscheduler.job import Job
  File "/usr/ports/devel/py-apscheduler/work/APScheduler-3.2.0/apscheduler/job.py", line 4, in <module>
    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
This commit is contained in:
Jan Beich 2016-07-18 16:15:01 +00:00
parent b4552dabef
commit c02ff86a83
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=418711
7 changed files with 9 additions and 8 deletions

View file

@ -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 <bsd.port.post.mk>

View file

@ -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 <bsd.port.post.mk>

View file

@ -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 <bsd.port.post.mk>

View file

@ -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 <bsd.port.mk>

View file

@ -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 <bsd.port.mk>

View file

@ -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 <bsd.port.mk>

View file

@ -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 <bsd.port.mk>