• [gentoo-dev] [PATCH 0/6] distutils-r1.eclass / python-utils-r1.eclass:

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jul 15 17:20:01 2025
    Hi,

    Two more changes to the EPYTEST_PLUGINS support in eclasses:

    1. distutils-r1.eclass will skip ${PN} when adding deps. This means
    that dev-python/pytest-foo will no longer have to do something like:

    EPYTEST_PLUGINS=( foo bar )
    distutils_enable_tests pytest

    python_test() {
    local EPYTEST_PLUGINS=( "${EPYTEST_PLUGINS[@]}" "${PN}" )
    epytest
    }

    but will instead be able to put PN into the global var.

    2. python-utils-r1.eclass will preserve entry point order. As it turns
    out, if you sort entry points from pytest-xdist, you get warnings.

    Includes a bunch of patches to ebuilds that benefit from these patches.


    Michał Górny (6):
    distutils-r1.eclass: Skip dep on ${PN} in EPYTEST_PLUGINS
    dev-python/pytest-asyncio: Simplify EPYTEST_PLUGINS
    dev-python/pytest-lazy-fixtures: Simplify EPYTEST_PLUGINS
    dev-python/tavern: Simplify EPYTEST_PLUGINS
    python-utils-r1.eclass: Preserve order in PYTEST_PLUGINS
    dev-python/inline-snapshot: Use EPYTEST_PLUGINS

    .../inline-snapshot-0.24.0.ebuild | 4 +--
    .../pytest-asyncio-1.0.0.ebuild | 29 +++++++----------
    .../pytest-lazy-fixtures-1.2.0.ebuild | 7 +----
    dev-python/tavern/tavern-2.16.0.ebuild | 31 ++++++++-----------
    eclass/distutils-r1.eclass | 4 +++
    eclass/python-utils-r1.eclass | 8 +++--
    6 files changed, 37 insertions(+), 46 deletions(-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jul 15 17:30:01 2025
    When `EPYTEST_PLUGINS` contains `${PN}`, skip it when adding
    dependencies. This avoids a self-dependency, while making it possible
    to easily test pytest plugins themselves without having to append to `EPYTEST_PLUGINS` locally.

    Signed-off-by: Michał Górny <[email protected]>
    ---
    eclass/distutils-r1.eclass | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index b9366d187555..7b025261eb2b 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -565,6 +565,10 @@ distutils_enable_tests() {
    _set_epytest_plugins
    for plugin in "${EPYTEST_PLUGINS[@]}"; do
    case ${plugin} in
    + ${PN})
    + # don't add a dependency on self
    + continue
    + ;;
    pkgcore)
    plugin=sys-apps/${plugin}
    ;;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jul 15 17:30:01 2025
    Do not sort entry points when adding them to `PYTEST_PLUGINS`.
    Apparently, the order of loading does matter, and reordering
    the entry points from `dev-python/pytest-xdist` leads to warnings
    that break the test suite of `dev-python/inline-snapshot`.

    Signed-off-by: Michał Górny <[email protected]>
    ---
    eclass/python-utils-r1.eclass | 8 +++++---
    1 file changed, 5 insertions(+), 3 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 68faa9e2adf9..9cdfdc87019f 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1458,11 +1458,13 @@ epytest() {
    from importlib.metadata import distribution, entry_points

    packages = {distribution(x).name for x in sys.argv[1:]}
    - plugins = {
    + # In packages defining multiple entry points, we must
    + # list them in the same order! + plugins = (
    x.value for x in entry_points(group="pytest11")
    if x.dist.name in packages
    - }
    - sys.stdout.write(",".join(sorted(plugins)))
    + )
    + sys.stdout.write(",".join(plugins))
    EOF
    )
    else

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)