public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/agate/
Date: Mon, 21 Jun 2021 21:19:24 +0000 (UTC)	[thread overview]
Message-ID: <1624310360.1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.zmedico@gentoo> (raw)

commit:     1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 21 21:06:56 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 21 21:19:20 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ded69a8

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 <AT> gentoo.org>
Reported-by: David Seifert <soap <AT> gentoo.org>
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 dev-python/agate/agate-1.6.2.ebuild | 30 +++++++++++++++++++++---------
 1 file 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 6c3fd2a618f..25dfaf8d73d 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
 }


             reply	other threads:[~2021-06-21 21:19 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 21:19 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-07-30  2:47 [gentoo-commits] repo/gentoo:master commit in: dev-python/agate/ Michał Górny
2024-06-18 16:57 Michał Górny
2024-05-28  7:40 Michał Górny
2024-05-28  4:42 Michał Górny
2024-05-03  7:08 Arthur Zamarin
2024-04-29  3:33 Michał Górny
2024-04-28 16:12 Arthur Zamarin
2024-04-28  2:37 Michał Górny
2024-04-01  9:46 Michał Górny
2023-12-30 18:26 Michał Górny
2023-12-22  8:30 Michał Górny
2023-10-29 11:10 Michał Górny
2023-10-28 19:28 Michał Górny
2023-10-18  5:06 Michał Górny
2023-10-10 18:11 Michał Górny
2023-01-05  8:28 Michał Górny
2023-01-04 14:15 Michał Górny
2022-06-04 17:13 Michał Górny
2022-03-28 22:48 Zac Medico
2022-02-04 18:05 Zac Medico
2021-10-09  6:34 Arthur Zamarin
2021-08-02  8:17 Michał Górny
2021-08-02  8:17 Michał Górny
2021-08-02  8:17 Michał Górny
2021-08-02  8:17 Michał Górny
2021-07-15 17:50 Michał Górny
2021-06-22 19:11 Zac Medico
2021-06-22  0:58 Zac Medico
2021-06-21 23:32 Zac Medico
2021-06-21 23:04 Zac Medico
2021-06-21 19:38 Zac Medico
2021-06-21  8:23 Zac Medico
2021-06-21  6:25 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1624310360.1ded69a8ae9c41da9bf7da03b65fdb2ec38a9376.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox