Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/agate/
Date: Mon, 21 Jun 2021 21:19:28
Message-Id: 1624310360.1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.zmedico@gentoo
1 commit: 1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 21 21:06:56 2021 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 21 21:19:20 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ded69a8
7
8 dev-python/agate: Replace pytest-expect with pure bash
9
10 Replace pytest-expect with pure bash in order to use
11 the preferred skipping-tests-based-on-paths-names recipe
12 via epytest --deselect arguments, and also add the missing
13 epytest die call reported by David Seifert.
14
15 The included pytest-expect-to-deselect function can
16 perhaps be migrated to an eclass somewhere:
17
18 # @FUNCTION: pytest-expect-to-deselect
19 # @USAGE: readarray -t pytest_args < <(pytest-expect-to-deselect <<<PYTEST_EXPECT_CONTENT)
20 # @DESCRIPTION:
21 # Read a pytest-expect pytest --xfail-file file from stdin and write
22 # equivalent pytest --deselect arguments to stdout for consumption by
23 # readarray -t. The generated pytest --deselect arguments are appropriate
24 # for use as described here:
25 # https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names
26 pytest-expect-to-deselect() {
27 while read -r; do
28 [[ ${REPLY} =~ ^[u]?\'([^\']*) ]] || continue
29 printf -- '%s\n' --deselect "${BASH_REMATCH[1]}" || return
30 done
31 }
32
33 See: https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names
34 Bug: https://bugs.gentoo.org/797307
35 Reported-by: Michał Górny <mgorny <AT> gentoo.org>
36 Reported-by: David Seifert <soap <AT> gentoo.org>
37 Package-Manager: Portage-3.0.20, Repoman-3.0.3
38 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
39
40 dev-python/agate/agate-1.6.2.ebuild | 30 +++++++++++++++++++++---------
41 1 file changed, 21 insertions(+), 9 deletions(-)
42
43 diff --git a/dev-python/agate/agate-1.6.2.ebuild b/dev-python/agate/agate-1.6.2.ebuild
44 index 6c3fd2a618f..25dfaf8d73d 100644
45 --- a/dev-python/agate/agate-1.6.2.ebuild
46 +++ b/dev-python/agate/agate-1.6.2.ebuild
47 @@ -25,20 +25,32 @@ RDEPEND="
48 >=dev-python/python-slugify-1.2.1[${PYTHON_USEDEP}]
49 >=dev-python/leather-0.3.2[${PYTHON_USEDEP}]
50 "
51 -BDEPEND="
52 - test? (
53 - dev-python/pytest-expect[${PYTHON_USEDEP}]
54 - )
55 -"
56
57 distutils_enable_tests pytest
58
59 -python_prepare_all() {
60 - cat > .pytest.expect <<-EOF
61 +# @FUNCTION: pytest-expect-to-deselect
62 +# @USAGE: readarray -t pytest_args < <(pytest-expect-to-deselect <<<PYTEST_EXPECT_CONTENT)
63 +# @DESCRIPTION:
64 +# Read a pytest-expect pytest --xfail-file file from stdin and write
65 +# equivalent pytest --deselect arguments to stdout for consumption by
66 +# readarray -t. The generated pytest --deselect arguments are appropriate
67 +# for use as described here:
68 +# https://dev.gentoo.org/~mgorny/python-guide/pytest.html#skipping-tests-based-on-paths-names
69 +pytest-expect-to-deselect() {
70 + while read -r; do
71 + [[ ${REPLY} =~ ^[u]?\'([^\']*) ]] || continue
72 + printf -- '%s\n' --deselect "${BASH_REMATCH[1]}" || return
73 + done
74 +}
75 +
76 +python_test() {
77 + local -a pytest_args
78 + readarray -t pytest_args < <(pytest-expect-to-deselect <<<"
79 pytest-expect file v1
80 (3, 8, 10, 'final', 0)
81 u'tests/test_data_types.py::TestDate::test_cast_format_locale': FAIL
82 u'tests/test_data_types.py::TestDateTime::test_cast_format_locale': FAIL
83 -EOF
84 - distutils-r1_python_prepare_all
85 +")
86 +
87 + epytest "${pytest_args[@]}" || die
88 }