Bug 2063769

Summary: Please provide python3-pytest-asyncio for EPEL-9
Product: [Fedora] Fedora EPEL Reporter: Stefan Bluhm <fedoraproject.org>
Component: python-pytest-asyncioAssignee: Carl George 🤠 <carl>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel9CC: carl, code, jujens, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pytest-asyncio-0.18.3-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-23 19:34:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2063779    
Bug Blocks: 2063754    

Description Stefan Bluhm 2022-03-14 11:00:44 UTC
Can you please provide python3-pytest-asyncio for EPEL-9?

Build seems to fail on 
DEBUG util.py:444:  No matching package to install: 'python3dist(setuptools-scm) >= 6.2'
DEBUG util.py:444:  No matching package to install: 'python3dist(setuptools-scm[toml]) >= 6.2'

Thank you and best wishes,

Stefan

Comment 1 Stefan Bluhm 2022-03-14 12:15:58 UTC
python3-setuptools_scm is included in RHEL 9 (CRB repo).

Comment 2 Ben Beasley 2022-03-14 13:25:53 UTC
(In reply to Stefan Bluhm from comment #1)
> python3-setuptools_scm is included in RHEL 9 (CRB repo).

The problem here is that it’s version 6.0.1, and pyproject.toml is asking for >=6.2.0. After consulting the upstream changelog[1], I guessed that 6.0.1 is probably still OK for the limited requirements of the RPM build, and tried a build with the dependency loosened. For testing, I used this sed expression in %prep:

> sed -r -i 's/("setuptools_scm\[toml\]>=)6\.2"/\16.0.1"/' pyproject.toml

The result was:

> No matching package to install: 'python3dist(flaky) >= 3.5'
> No matching package to install: 'python3dist(mypy) = 0.931'

-----

The mypy dependency should ideally be patched out anyway[2]. Perhaps no-coverage.patch could become no-linters.patch. I used another sed expression to test this:

> sed -r -i '/\bmypy\b/d' setup.cfg

-----

The flaky dependency can be patched out if we skip the flaky integration test. (Why test integration with something that isn’t currently packaged?) That said, it would be *good* to get flaky in EPEL9.

> %pytest --ignore=tests/test_flaky_integration.py

I tested this with the above pytest argument and with

> sed -r -i '/\bflaky\b/d' setup.cfg

-----

After all that, a mock build almost succeeded, except that all of the tests in tests/modes/test_legacy_mode.py failed because they had each had two warnings instead of the expected one. The extra warning was:

> ../../../../usr/lib/python3.9/site-packages/_pytest/config/__init__.py:676
>   /usr/lib/python3.9/site-packages/_pytest/config/__init__.py:676: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: pytest_asyncio
>     self.import_plugin(import_spec)

I recognize this warning as occurring because pytest finds pytest_asyncio in the current working directory *and* in %{buildroot}%{python3_sitelib}. This was a workaround for that:

> %global __pytest %{python3} -m pytest

and I guess it’s working on Fedora, but it’s not working on RHEL9. An alternative solution that does work is:

> %check
> # Keeps tests/modes/test_legacy_mode.py from failing with extra PytestAssertRewriteWarning
> # (ensure it only finds the copy in buildroot site-packages)
> rm -rf pytest_asyncio
> %pytest --ignore=tests/test_flaky_integration.py

This removal seems drastic but is harmless since %install has already happened by the time %check runs.

-----

So it looks like an EPEL9 package is possible with those changes:

- Loosen setuptools_scm[toml] min. version to 6.0.1 in pyproject.toml.
- Patch out mypy and flaky dependencies in setup.cfg.
- Skip the flaky integration test.
- Use a different approach to preventing extra warnings in the legacy mode tests: removing the local pytest_asyncio directory is easy and works.

Let me know if there is anything I can do to help with this.

[1] https://github.com/pypa/setuptools_scm/blob/main/CHANGELOG.rst#v620
[2] https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters

Comment 3 Ben Beasley 2022-03-14 13:28:29 UTC
I accidentally dropped “--release epel9” from my last mockbuild. It turns out that

> rm -rf pytest_asyncio

is not a solution for the extra warnings causing the legacy mode tests to fail.

Something else is needed—I’m not sure what—or perhaps these can be skipped.

Comment 4 Carl George 🤠 2022-04-20 20:40:34 UTC
This source package was due to be renamed from python3-pytest-asyncio to python-pytest-asyncio to comply with the Python packaging guidelines [0].  I've completed that work [1], and I've built python-pytest-asyncio for EPEL9 as well.  Note that it is only the source package (and dist-git repo) that were renamed, the built package is still named python3-pytest-asyncio.

[0] https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_library_naming
[1] bug 2076825

Comment 5 Fedora Update System 2022-04-20 20:43:08 UTC
FEDORA-EPEL-2022-f26d6cc8cc has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f26d6cc8cc

Comment 6 Ben Beasley 2022-04-20 23:31:10 UTC
Awesome! Thank you.

Comment 7 Fedora Update System 2022-04-21 22:32:24 UTC
FEDORA-EPEL-2022-f26d6cc8cc has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f26d6cc8cc

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-04-23 19:34:00 UTC
FEDORA-EPEL-2022-f26d6cc8cc has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.