ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
830 stars 1.53k forks source link

ansible: mail integration tests uses the asyncore module which has been removed in Python 3.11 #4656

Open vstinner opened 2 years ago

vstinner commented 2 years ago

Summary

The ansible_collections/community/general/tests/integration/targets/mail/files/smtpserver.py uses import asyncore whereas this module has been removed in Python 3.11, after being deprecated since Python 3.6.

One option is to copy Python 3.10 asyncore.py file in ansible test suite. Another is that someone should maintain an asyncore module on PyPI.

First, I reported the issue at https://github.com/ansible/ansible/issues/76452 but I got rejected there.

Issue Type

Bug Report

Component Name

tests

Ansible Version

ansible-5.0.0 source code from PyPI.

Community.general Version

$ ansible-galaxy collection list community.general

Configuration

$ ansible-config dump --only-changed

OS / Environment

Any operating system.

Steps to Reproduce

Run the ansible integration test suite on Python 3.11: it emits a deprecation warning. The module will be removed from Python 3.12: see https://github.com/python/cpython/issues/72719

Expected Results

ansible-5.0.0/ansible_collections/community/general/tests/integration/targets/mail/files/smtpserver.py must not fail.

Actual Results

I didn't try to run the Ansible test suite. I only noticed that "import asyncore" is used.

Code of Conduct

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

vstinner commented 2 years ago

!component =tests/integration/targets/mail/files/smtpserver.py

vstinner commented 2 years ago

Link to the line importing asyncore: https://github.com/ansible-collections/community.general/blob/cf55ef852e044d4d8be756522521cbf698d9fa22/tests/integration/targets/mail/files/smtpserver.py#L10

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

felixfontein commented 2 years ago

Thanks for this report! Instead of vendoring that module, I think we should better adjust the test.

felixfontein commented 2 years ago

The same test also depends on the smtpd module, which will be removed from Python 3.12.

I was about to suggest the following route:

  1. Continue to use the current solution for Python 2 and Python 3.5.
  2. Use another solution for Python 3.6+. aiosmtpd looks promising on the first glance, but it doesn't even support Python 3.10, and there have been no commits for over a year.

Right now I'm more thinking of installing and configuring something like postfix instead? That's probably more work, but seems less painful to maintain.

vstinner commented 2 months ago

No activity for 2 years, I close the issue.

felixfontein commented 2 months ago

It's not resolved, so it should be kept open until someone wants to work on this.