Awesome Open Source
Awesome Open Source


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

And your test file:

# tests/

from your_module import validate_email

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

You can also specify 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.

Related projects

You might also be interested in:


pytest-mimesis is licensed under the MIT License.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (48,431
testing (881
plugin (709
testing-tools (188
pytest (66
faker (40
pytest-plugin (27
fixtures (23
fake-data (18

Find Open Source By Browsing 7,000 Topics Across 59 Categories