$ time pytest --disable-warnings --durations 1 test_ssl.py
=============================================== test session starts ================================================
platform linux -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/eloi/test
plugins: smtpdfix-0.5.1
collected 1 item
test_ssl.py . [100%]
=============================================== slowest 1 durations ================================================
2.04s call test_ssl.py::test_send_test_email_ssl
========================================== 1 passed, 2 warnings in 2.09s ===========================================
pytest --disable-warnings --durations 1 test_ssl.py 0,40s user 0,04s system 17% cpu 2,442 total
Here the test takes 2,04s, but without SSL it would take 0.01s.
Duplicating the very same ssl test takes twice as long, so whatever is causing this delay is executed on each test.
I suspect being slow is something hard to avoid with SSL, but maybe there are strategies to mitigate this? Whatever takes time, are there things to cache during the test sessions, less secure algorithms to choose, or shorter keys, so everything goes fast?
Sending a single mail to smtpdfix with SSL enabled on a very capable computer can take more than 1s.
This can easily be reproduced with this test:
Here the test takes 2,04s, but without SSL it would take 0.01s. Duplicating the very same ssl test takes twice as long, so whatever is causing this delay is executed on each test.
I suspect being slow is something hard to avoid with SSL, but maybe there are strategies to mitigate this? Whatever takes time, are there things to cache during the test sessions, less secure algorithms to choose, or shorter keys, so everything goes fast?
Any thoughts?
Environment