From d80996e24db605ecfcfa5cba85ead0ccffe201cc Mon Sep 17 00:00:00 2001 From: WXTIM <26465611+wxtim@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:44:40 +0000 Subject: [PATCH] replace smtpd with aiosmtpd in the test_header file --- setup.cfg | 1 + tests/functional/lib/bash/test_header | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index d5fd84a80b8..258081301c9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -103,6 +103,7 @@ report-timings = pandas==1.* matplotlib tests = + aiosmtpd async_generator bandit>=1.7.0 coverage>=5.0.0,<7.3.1 diff --git a/tests/functional/lib/bash/test_header b/tests/functional/lib/bash/test_header index 458a7dc908c..818c8522c5c 100644 --- a/tests/functional/lib/bash/test_header +++ b/tests/functional/lib/bash/test_header @@ -807,10 +807,13 @@ mock_smtpd_init() { # Logic borrowed from Rose local SMTPD_LOG="${TEST_DIR}/smtpd.log" local SMTPD_HOST="localhost:${SMTPD_PORT}" # Set up fake SMTP server to catch outgoing mail & redirect to log: - python3 -u -m 'smtpd' -c 'DebuggingServer' -d -n "${SMTPD_HOST}" \ + python3 -u -m 'aiosmtpd' \ + --class aiosmtpd.handlers.Debugging stderr \ + --debug --nosetuid \ + --listen "${SMTPD_HOST}" \ 1>"${SMTPD_LOG}" 2>&1 & # Runs in background local SMTPD_PID="$!" - while ! grep -q 'DebuggingServer started' "${SMTPD_LOG}" 2>'/dev/null' + while ! grep -q 'is listening' "${SMTPD_LOG}" 2>'/dev/null' do if ps "${SMTPD_PID}" 1>/dev/null 2>&1; then sleep 1 # Still waiting for fake server to start