Bug 2354143

Summary: python-mailman-hyperkitty FTBFS due to missing tox configuration
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-mailman-hyperkittyAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: infra-sig, kevin, michel, ngompa13, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-mailman-hyperkitty-1.2.1-6.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-03-31 21:18:56 UTC Type: ---
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:    
Bug Blocks: 2339432, 2322407    

Description Miro Hrončok 2025-03-21 16:55:03 UTC
Hello.

python-mailman-hyperkitty fails to build from source becasue it uses one or both of:

 - %pyproject_buildrequires -t/-e (generate dependencies via tox)
 - %tox (run tox)

without tox configuration (e.g. tox.ini or tox section of pyproject.toml/setup.cfg).

This was always supposed to fail, but regressed with tox 4.
Now it fails again.

https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/ZSHSHZKVA4XJQBJD7FMMCALKN4UP5SAJ/
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/N25A2BER3RUHMTBIULQ6AVWRILSL5VGW/

If this package uses tox upstream, make sure to use a source tarball that includes the tox configuration (e.g. an archive from GitHub instead of sdist from PyPI).

If this package does not use tox upstream, you cannot use the tox options.
If your package uses %pyproject_buildrequires -t/-e but does not use %tox, just drop the -t/-e option.
If your package uses %tox, replace the call with a more suitable way for running tests (e.g. %pytest).

Let me know if you need assistance. Thanks.

Comment 1 Miro Hrončok 2025-03-21 16:59:14 UTC
This was already somehow acknowledged in https://src.fedoraproject.org/rpms/python-mailman-hyperkitty/c/7f26f758a6a00f5b986828acfbbd04d66bf2fd03?branch=rawhide -- tox does not work on EL 9 because tox in EL 9 always failed in this case.

Comment 2 Miro Hrončok 2025-03-28 12:42:04 UTC
Hello. If you need help fixing this, please let me know. If you plan to fix this yourself, please respond. Thanks.

Comment 3 Kevin Fenzi 2025-03-29 18:15:36 UTC
so, switching to pytest shows a bunch of test failures... basically all of them.

https://koji.fedoraproject.org/koji/taskinfo?taskID=130885224 is a scratch build to look at.

I don't have too much more time to look, help from anywhere welcome.

Comment 4 Miro Hrončok 2025-03-29 20:51:07 UTC
Upstream has https://gitlab.com/mailman/mailman-hyperkitty/-/blob/1.2.1/tox.ini?ref_type=tags

Looking at it and the failures, I guess this might be a missing dependency on python3dist(mailman)?

It might be a good idea to reuse that tox.ini, but it is not present in the sdist.

------

Anyway, with this:


BuildRequires:  python3-nose2
BuildRequires:  mailman3
...
%check
%{py3_test_envvars} %{python3} -m nose2 -v


I get:

+ /usr/bin/python3 -m nose2 -v
LayerSuite ... ERROR

======================================================================
ERROR: LayerSuite
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/mailman/testing/layers.py", line 135, in setUp
    initialize.initialize_2(testing=True)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mailman/core/initialize.py", line 199, in initialize_2
    initialize_commands()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/mailman/app/commands.py", line 29, in initialize
    add_components('commands', IEmailCommand, config.commands)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mailman/utilities/modules.py", line 218, in add_components
    for component_class in find_pluggable_components(subpackage, interface):
                           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mailman/utilities/modules.py", line 177, in find_pluggable_components
    yield from find_components('mailman.' + subpackage, interface)
  File "/usr/lib/python3.13/site-packages/mailman/utilities/modules.py", line 150, in find_components
    module = import_module(module_name)
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.13/site-packages/mailman/commands/cli_gatenews.py", line 24, in <module>
    import nntplib
ModuleNotFoundError: No module named 'nntplib'

----------------------------------------------------------------------
Ran 0 tests in 0.526s

FAILED (errors=1)


nntplib was removed from Python 3.13 https://docs.python.org/3/whatsnew/3.13.html#whatsnew313-pep594

I guess this stack is utterly broken, and never running tests did not help. Mailman3 itself runs this thing in %check:

    venv/bin/python -m nose2 -v || :

And the latest build https://koji.fedoraproject.org/koji/buildinfo?buildID=2661280 failed the tests with:

======================================================================
ERROR: mailman.commands.tests.test_cli_gatenews (nose2.loader.ModuleImportFailure.mailman.commands.tests.test_cli_gatenews)
----------------------------------------------------------------------
ImportError: Failed to import test module: mailman.commands.tests.test_cli_gatenews
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/nose2/plugins/loader/discovery.py", line 195, in _find_tests_in_file
    module = util.module_from_name(module_name)
  File "/usr/lib/python3.13/site-packages/nose2/util.py", line 73, in module_from_name
    __import__(name)
    ~~~~~~~~~~^^^^^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/commands/tests/test_cli_gatenews.py", line 21, in <module>
    import nntplib
ModuleNotFoundError: No module named 'nntplib'
======================================================================
ERROR: test_opening_character_device (mailman.core.tests.test_logging.TestRunner.test_opening_character_device)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/tests/test_logging.py", line 28, in test_opening_character_device
    handler = ReopenableFileHandler('test', '/dev/stdout')
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/logging.py", line 51, in __init__
    self._stream = self._open()
                   ~~~~~~~~~~^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/logging.py", line 64, in _open
    return codecs.open(self.filename, open_mode, 'utf-8')
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen codecs>", line 921, in open
PermissionError: [Errno 13] Permission denied: '/dev/stdout'
======================================================================
ERROR: mailman.runners.tests.test_nntp (nose2.loader.ModuleImportFailure.mailman.runners.tests.test_nntp)
----------------------------------------------------------------------
ImportError: Failed to import test module: mailman.runners.tests.test_nntp
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/nose2/plugins/loader/discovery.py", line 195, in _find_tests_in_file
    module = util.module_from_name(module_name)
  File "/usr/lib/python3.13/site-packages/nose2/util.py", line 73, in module_from_name
    __import__(name)
    ~~~~~~~~~~^^^^^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/runners/tests/test_nntp.py", line 21, in <module>
    import nntplib
ModuleNotFoundError: No module named 'nntplib'
======================================================================
ERROR: LayerSuite
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/testing/layers.py", line 135, in setUp
    initialize.initialize_2(testing=True)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/core/initialize.py", line 199, in initialize_2
    initialize_commands()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/app/commands.py", line 29, in initialize
    add_components('commands', IEmailCommand, config.commands)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 218, in add_components
    for component_class in find_pluggable_components(subpackage, interface):
                           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 177, in find_pluggable_components
    yield from find_components('mailman.' + subpackage, interface)
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/utilities/modules.py", line 150, in find_components
    module = import_module(module_name)
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILD/mailman3-3.3.9-build/mailman-3.3.9/src/mailman/commands/cli_gatenews.py", line 24, in <module>
    import nntplib
ModuleNotFoundError: No module named 'nntplib'
----------------------------------------------------------------------
Ran 53 tests in 0.261s
FAILED (errors=4)


But nobody noticed when we updated Python to 3.13 because the test result is ignored, which is explicitly forbidden by the guidelines https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_running_tests -- exactly for this reason.

Comment 5 Miro Hrončok 2025-03-29 20:54:07 UTC
https://gitlab.com/mailman/mailman/-/issues/1176 is the upstream mailman issue

Comment 6 Miro Hrončok 2025-03-29 21:01:25 UTC
https://src.fedoraproject.org/rpms/python-mailman-hyperkitty/pull-request/1 contains a workaround.

Comment 7 Fedora Update System 2025-03-31 21:16:45 UTC
FEDORA-2025-31e5fc0fd0 (python-mailman-hyperkitty-1.2.1-6.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-31e5fc0fd0

Comment 8 Fedora Update System 2025-03-31 21:18:56 UTC
FEDORA-2025-31e5fc0fd0 (python-mailman-hyperkitty-1.2.1-6.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.