Skip to main content

Mimesis integration with the pytest test runner

Project description


Build Status wemake-python-styleguide Python Version

pytest-mimesis is a pytest plugin that provides pytest fixtures for Mimesis providers. This allows you to quickly and easily use randomized, dummy data as part of your test suite.


pip install pytest-mimesis


Using the personal provider as part of a test.

# your_module/

def validate_email(email):
    # code that validates an e-mail address
    return True


from your_module import validate_email

def test_validate_email(mimesis):
    assert validate_email(mimesis('email'))

Specifying locales:

@pytest.mark.parameterize('mimesis_locale', 'de')  # use German locale
def test_create_user(mimesis):
    assert create_user(name=mimesis('full_name'))

@pytest.mark.parameterize('mimesis_locale', ['de', 'en', 'jp'])  # test multiple locales
def test_add_phone(user, mimesis):
    assert user.add_phone_number(name=mimesis('full_name'))


We provide two public fixtures: mimesis_locale and mimesis. While mimesis_locale is just a string (like: en, ru), mimesis is an instance of mimesis.schema.Field.

We use caching of mimesis instances for different locales for the whole test session, so creating new instances is cheap.


pytest-mimesis is licensed under the MIT License.

Project details

Download files

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

Files for pytest-mimesis, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pytest_mimesis-1.0.1-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pytest_mimesis-1.0.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page