A unit testing tool for code that sends email.
Project description
MailTest is a Python unittesting library that for code that sends email. It starts a local SMTP server inside a Python with block, and captures all the email sent to it. These emails can then be read within the block.
Example:
with mailtest.Server() as mt:
send_welcome_email()
assert len(mt.emails) == 1
Install
pip3 install mailtest
Configuration
Configuration is done via kwargs to mailtest.Server(). Options: - smtp_port (defaults to 1025) - sendgrid_port (TODO)
Speed
MailTest can test receive approx. 4000 emails/second on an Intel(R) Core(TM) i5-7260U CPU @ 2.20GHz.
Testing
$ python2 test.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.269s OK
$ python3 test.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.543s OK
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mailtest-1.0.0.tar.gz
(2.1 kB
view details)
File details
Details for the file mailtest-1.0.0.tar.gz.
File metadata
- Download URL: mailtest-1.0.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb134649a79aae969bf8293f1593e0492481fb23a0999cc13803455a1e173397
|
|
| MD5 |
fe2a304f379c75562ecd1e32fd09e4b0
|
|
| BLAKE2b-256 |
b8ed55d6cb39bde39ed1e362f7fac2a5ccbcf8acf9a8f536c2bdf10112c5895f
|