diff options
author | Zac Medico <zmedico@gentoo.org> | 2021-06-21 14:06:56 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2021-06-21 14:19:20 -0700 |
commit | 1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376 (patch) | |
tree | 5db44a5376517f4749478fb7479629c9172b06b1 /dev-python | |
parent | dev-perl/JavaScript-Minifier: Version bump 1.16 (diff) | |
download | gentoo-1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.tar.gz gentoo-1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.tar.bz2 gentoo-1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.zip |
dev-python/agate: Replace pytest-expect with pure bash
Replace pytest-expect with pure bash in order to use
the preferred skipping-tests-based-on-paths-names recipe
via epytest --deselect arguments, and also add the missing
epytest die call reported by David Seifert.
The included pytest-expect-to-deselect function can
perhaps be migrated to an eclass somewhere:
# @FUNCTION: pytest-expect-to-deselect
# @USAGE: readarray -t pytest_args < <(pytest-expect-to-deselect <<<PYTEST_EXPECT_CONTENT)
# @DESCRIPTION:
# Read a pytest-expect pytest --xfail-file file from stdin and write
# equivalent pytest --deselect arguments to stdout for consumption by
# readarray -t. The generated pytest --deselect arguments are appropriate
# for use as described here:
# https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names
pytest-expect-to-deselect() {
while read -r; do
[[ ${REPLY} =~ ^[u]?\'([^\']*) ]] || continue
printf -- '%s\n' --deselect "${BASH_REMATCH[1]}" || return
done
}
See: https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names
Bug: https://bugs.gentoo.org/797307
Reported-by: Michał Górny <mgorny@gentoo.org>
Reported-by: David Seifert <soap@gentoo.org>
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r-- | dev-python/agate/agate-1.6.2.ebuild | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/dev-python/agate/agate-1.6.2.ebuild b/dev-python/agate/agate-1.6.2.ebuild index 6c3fd2a618fb..25dfaf8d73d1 100644 --- a/dev-python/agate/agate-1.6.2.ebuild +++ b/dev-python/agate/agate-1.6.2.ebuild @@ -25,20 +25,32 @@ RDEPEND=" >=dev-python/python-slugify-1.2.1[${PYTHON_USEDEP}] >=dev-python/leather-0.3.2[${PYTHON_USEDEP}] " -BDEPEND=" - test? ( - dev-python/pytest-expect[${PYTHON_USEDEP}] - ) -" distutils_enable_tests pytest -python_prepare_all() { - cat > .pytest.expect <<-EOF +# @FUNCTION: pytest-expect-to-deselect +# @USAGE: readarray -t pytest_args < <(pytest-expect-to-deselect <<<PYTEST_EXPECT_CONTENT) +# @DESCRIPTION: +# Read a pytest-expect pytest --xfail-file file from stdin and write +# equivalent pytest --deselect arguments to stdout for consumption by +# readarray -t. The generated pytest --deselect arguments are appropriate +# for use as described here: +# https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names +pytest-expect-to-deselect() { + while read -r; do + [[ ${REPLY} =~ ^[u]?\'([^\']*) ]] || continue + printf -- '%s\n' --deselect "${BASH_REMATCH[1]}" || return + done +} + +python_test() { + local -a pytest_args + readarray -t pytest_args < <(pytest-expect-to-deselect <<<" pytest-expect file v1 (3, 8, 10, 'final', 0) u'tests/test_data_types.py::TestDate::test_cast_format_locale': FAIL u'tests/test_data_types.py::TestDateTime::test_cast_format_locale': FAIL -EOF - distutils-r1_python_prepare_all +") + + epytest "${pytest_args[@]}" || die } |