aiosmtpd
aiosmtpd copied to clipboard
Allow setting port=0 to use OS-assigned port.
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.pyonly)
- [x] Linux (Ubuntu 22.04):
- [ ] Documentation reflects the changes
- [x] Add a news fragment into the
NEWS.rstfile
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...