All Projects → pytest-dev → Pytest Mimesis

pytest-dev / Pytest Mimesis

Licence: mit
Mimesis integration with the pytest test runner. This plugin provider useful fixtures based on providers from Mimesis.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytest Mimesis

Beanmother
A library for setting up Java objects as test data.
Stars: ✭ 102 (+121.74%)
Mutual labels:  faker, testing-tools, fixtures
main
Mocks Server monorepo
Stars: ✭ 109 (+136.96%)
Mutual labels:  fixtures, testing-tools
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+52.17%)
Mutual labels:  fixtures, faker
pytest-localstack
Pytest plugin for local AWS integration tests
Stars: ✭ 66 (+43.48%)
Mutual labels:  pytest, testing-tools
Kotlin Faker
Generate realistically looking fake data such as names, addresses, banking details, and many more, that can be used for testing and data anonymization purposes.
Stars: ✭ 136 (+195.65%)
Mutual labels:  faker, testing-tools
Alice
Expressive fixtures generator
Stars: ✭ 2,289 (+4876.09%)
Mutual labels:  faker, fixtures
pytest-watcher
Rerun pytest when your code changes
Stars: ✭ 60 (+30.43%)
Mutual labels:  pytest, testing-tools
Pytest Datadir
pytest plugin for manipulating test data directories and files
Stars: ✭ 135 (+193.48%)
Mutual labels:  plugin, pytest
pytest-djangoapp
Nice pytest plugin to help you with Django pluggable application testing.
Stars: ✭ 35 (-23.91%)
Mutual labels:  pytest, testing-tools
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+7376.09%)
Mutual labels:  faker, fixtures
Typeorm Fixtures
💊 Fixtures loader for typeorm
Stars: ✭ 330 (+617.39%)
Mutual labels:  faker, fixtures
Faker
Go (Golang) Fake Data Generator for Struct
Stars: ✭ 1,698 (+3591.3%)
Mutual labels:  faker, testing-tools
Faker
Faker is a pure Elixir library for generating fake data.
Stars: ✭ 673 (+1363.04%)
Mutual labels:  faker, testing-tools
Foundry
A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
Stars: ✭ 216 (+369.57%)
Mutual labels:  faker, fixtures
Pytest Selenium
Plugin for running Selenium with pytest
Stars: ✭ 246 (+434.78%)
Mutual labels:  plugin, pytest
pytest-datafixtures
Data fixtures for pytest made simple
Stars: ✭ 24 (-47.83%)
Mutual labels:  fixtures, pytest
Gunit
xUnit-style test fixture adapter for go test
Stars: ✭ 94 (+104.35%)
Mutual labels:  testing-tools, fixtures
Pytest Repeat
pytest plugin for repeating test execution
Stars: ✭ 99 (+115.22%)
Mutual labels:  plugin, pytest
lovely-pytest-docker
Pytest plugin providing the ability to use docker-compose services as fixtures.
Stars: ✭ 73 (+58.7%)
Mutual labels:  fixtures, pytest
Pytest Html
Plugin for generating HTML reports for pytest results
Stars: ✭ 404 (+778.26%)
Mutual labels:  plugin, pytest

pytest-mimesis

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.

Installation

pip install pytest-mimesis

Examples

Using the personal provider as part of a test.

# your_module/__init__.py

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

And your test file:

# tests/test_email.py

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'))

Fixtures

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:

License

pytest-mimesis is licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].