diff --git a/Uses/pytest.mk b/Uses/pytest.mk new file mode 100644 --- /dev/null +++ b/Uses/pytest.mk @@ -0,0 +1,52 @@ +# handle testing with pytest +# +# Feature: pytest +# Usage: USES=pytest[:4] +# +# It implies USES=python:build automatically if no USES=python has been +# specified yet +# +# It provides the following additional variables: +# +# PYTEST_ARGS additional args to pytest (defaults to empty). +# PYTEST_IGNORED_TESTS lists of `pytest -k` patterns of tests to ignore +# (defaults to empty). +# PYTEST_FAILING_TESTS lists of `pytest -k` patterns of tests to ignore +# (defaults to empty). Works exactly the same way as +# PYTEST_IGNORED_TESTS, but conveys that the listed +# tests are not expected to fail and should be fixed +# +# MAINTAINER: amdmi3@FreeBSD.org + +.if !defined(_INCLUDE_USES_PYTEST_MK) +_INCLUDE_USES_MINIZIP_MK= yes + +.if !${USES:Mpython*} +python_ARGS= build +.include "${USESDIR}/python.mk" +.endif + +.if empty(pytest_ARGS) +TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} +.elif ${pytest_ARGS} == "4" +TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}pytest4>=0:devel/py-pytest4@${PY_FLAVOR} +.else +IGNORE= Incorrect 'USES+=pytest:${pytest_ARGS}' expecting 'USES+=pytest[:4]' +.endif + +PYTEST_IGNORED_TESTS?= +PYTEST_FAILING_TESTS?= +PYTEST_ARGS?= + +_PYTEST_ALL_IGNORED_TESTS= ${PYTEST_IGNORED_TESTS} ${PYTEST_FAILING_TESTS} +_PYTEST_FILTER_EXPRESSION= ${_PYTEST_ALL_IGNORED_TESTS:C/^(.)/and not \1/:tW:C/^and //} + +.if !target(do-test) +do-test: + @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest \ + -v -rs \ + -k '${_PYTEST_FILTER_EXPRESSION}' + ${PYTEST_ARGS} +.endif + +.endif diff --git a/ftp/py-aioftp/Makefile b/py-aioftp/Makefile --- a/ftp/py-aioftp/Makefile +++ b/py-aioftp/Makefile @@ -10,19 +10,16 @@ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/license.txt -TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest4>0:devel/py-pytest4@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pytest4-asyncio>=0:devel/py-pytest4-asyncio@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pytest4-cov>=0:devel/py-pytest4-cov@${PY_FLAVOR} \ +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest-asyncio>=0:devel/py-pytest-asyncio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-cov>=0:devel/py-pytest-cov@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}trustme>=0:security/py-trustme@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}async_timeout>0:devel/py-async_timeout@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}siosocks>0:net/py-siosocks@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}idna>0:dns/py-idna@${PY_FLAVOR} -USES= python:3.7+ +USES= python:3.7+ pytest USE_PYTHON= autoplist distutils NO_ARCH= yes - -do-test: - @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs +PYTEST_FAILING_TESTS= test_pasv_connection_pasv_forced_response_address .include diff --git a/devel/py-asttokens/Makefile b/py-asttokens/Makefile --- a/devel/py-asttokens/Makefile +++ b/py-asttokens/Makefile @@ -12,14 +12,15 @@ BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>=0:devel/py-setuptools_scm@${PY_FLAVOR} RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} -TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}astroid>0:devel/py-astroid@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}astroid>0:devel/py-astroid@${PY_FLAVOR} -USES= python:3.6+ +USES= python:3.6+ pytest USE_PYTHON= autoplist distutils NO_ARCH= yes - -do-test: - @cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test +PYTEST_FAILING_TESTS= test_assignment_expressions test_async_def test_decorators \ + test_fixture10 test_fixture11 test_fixture13 test_fixture3 \ + test_fixture4 test_fixture5 test_fixture7 test_fixture8 \ + test_fixture9 test_fstrings test_mark_tokens_simple \ + test_print_function test_splat test_sys_modules test_tuples .include diff --git a/www/py-multidict/Makefile b/py-multidict/Makefile --- a/www/py-multidict/Makefile +++ b/py-multidict/Makefile @@ -10,17 +10,13 @@ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE -TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} \ +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pytest-cov>=0:devel/py-pytest-cov@${PY_FLAVOR} -USES= python:3.7+ +USES= python:3.7+ pytest USE_PYTHON= autoplist cython distutils post-install: @${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/multidict/*.so -do-test: - @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs -o addopts= - .include