Go to file
2023-12-03 20:27:12 +01:00
.idea Initial commit 2023-11-29 22:19:19 +01:00
pytest_smtp_test_server Plugin Name in add_option 2023-12-03 20:27:12 +01:00
tests Initial commit 2023-11-29 22:19:19 +01:00
.gitignore Initial commit 2023-11-29 22:19:19 +01:00
.pylintrc Initial commit 2023-11-29 22:19:19 +01:00
CHANGELOG.md Classifier for python 3.11 2023-12-03 10:43:16 +01:00
LICENSE.txt Preparing for initial release 2023-12-03 10:35:14 +01:00
poetry.lock Preparing for initial release 2023-12-03 10:35:14 +01:00
poetry.toml Initial commit 2023-11-29 22:19:19 +01:00
pyproject.toml Wrong xUnit test result filename 2023-12-03 10:57:05 +01:00
README.md Preparing for initial release 2023-12-03 10:35:14 +01:00

pytest-smtp-test-server

pytest plugin for using smtp-test-server as pytest mock fixtures.

Installation

Installation with "pip"

pip install pytest-smtp-test-server

Installation with "poetry"

poetry add --group dev pytest-smtp-test-server

Usage

After installation, one could easily use one of the provided fixtures in your pytest test case:

def test_mail_sending(smtp_mock):
    my_mail_sending_method(host=smtp_mock.host, port=smtp_mock.port)
    assert len(smtp_mock.messages) == 1

Scopes

Fixtures are provided for different pytest fixture scopes for your convenience:

fixture name pytest fixture scope
smtp_mock function
class_smtp_mock class
module_smtp_mock module
package_smtp_mock package
session_smtp_mock session

If you require more control over hosts and ports, consider using smtp-test-server directly.