Skip to main content

pytest plugin for using `smtp-test-server` as a fixture

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_smtp_test_server-0.1.1.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

pytest_smtp_test_server-0.1.1-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page