Mercurial > hg
diff tests/test-patchbomb-tls.t @ 50732:b3a5af04da35 stable
tests: use simple mock smtp server instead of deprecated asyncore smtpd
test-patchbomb-tls.t would fail with:
.../hg/tests/dummysmtpd.py:6: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
import asyncore
.../hg/tests/dummysmtpd.py:8: DeprecationWarning: The smtpd module is deprecated and unmaintained and will be removed in Python 3.12. Please see aiosmtpd (https://aiosmtpd.readthedocs.io/) for the recommended replacement.
import smtpd
The recommended migration path to the standalone asiosmtpd would be overkill.
The tests do not need a full smtp server - we can just use a very simple mock
hack to preserve the existing test coverage.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 23 Mar 2023 16:45:12 +0100 |
parents | cfb6ca77e6bc |
children | 25055932042a |
line wrap: on
line diff
--- a/tests/test-patchbomb-tls.t Mon Jun 26 16:45:13 2023 +0200 +++ b/tests/test-patchbomb-tls.t Thu Mar 23 16:45:12 2023 +0100 @@ -7,7 +7,6 @@ $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid --logfile log -d \ > --tls smtps --certificate `pwd`/server.pem - listening at localhost:$HGPORT (?) $ cat a.pid >> $DAEMON_PIDS Set up repository: @@ -47,6 +46,11 @@ (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error) (?i)abort: .*?certificate.verify.failed.* (re) [255] + + $ cat ../log + * ssl error: * (glob) + $ : > ../log + #endif #if defaultcacertsloaded @@ -58,6 +62,10 @@ (?i)abort: .*?certificate.verify.failed.* (re) [255] + $ cat ../log + * ssl error: * (glob) + $ : > ../log + #endif $ DISABLECACERTS="--config devel.disableloaddefaultcerts=true" @@ -76,7 +84,8 @@ [150] $ cat ../log - * ssl error: * (glob) + connection from * (glob) + no hello: b'' $ : > ../log With global certificates: @@ -91,6 +100,7 @@ sending [PATCH] a ... $ cat ../log + connection from * (glob) * from=quux to=foo, bar (glob) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii"