aiosmtpd icon indicating copy to clipboard operation
aiosmtpd copied to clipboard

Allow setting port=0 to use OS-assigned port.

Open alext opened this issue 2 years ago • 1 comments

What do these changes do?

Allow using port=0 when creating a Controller to use an OS-assigned port. Using port=0 is useful for ephemeral servers (eg for tests) where a given port can't necessarily be guaranteed to be available.

Are there changes in behavior for the user?

No changes to existing behaviour (when specifying a non-zero port, or leaving it at the default).

Related issue number

Closes: #276 (this implements the changes described in the comments on that issue)

Checklist

  • [x] I think the code is well written
  • [x] Unit tests for the changes exist
  • [x] tox testenvs have been executed in the following environments:
    • [x] Linux (Ubuntu 22.04): py310-nocov (test_server.py only)
  • [ ] Documentation reflects the changes
  • [x] Add a news fragment into the NEWS.rst file

alext avatar Jul 10 '23 11:07 alext

Note: I've not been able to get the full test suite to run locally - it appears to hang within test_main.py. I've successfully run the test_server.py tests though...

alext avatar Jul 10 '23 11:07 alext