{"id":24424,"library":"pytest-faker","title":"pytest-faker","description":"pytest-faker is a plugin for pytest that provides access to Faker fixtures for generating fake data in tests. Current version is 2.0.0. The library is actively maintained by the pytest-dev organization, with releases following changes to Faker and pytest.","status":"active","version":"2.0.0","language":"python","source_language":"en","source_url":"https://github.com/pytest-dev/pytest-faker","tags":["pytest","faker","fake data","testing","fixtures"],"install":[{"cmd":"pip install pytest-faker","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"pytest-faker is a pytest plugin; requires pytest to run.","package":"pytest","optional":false},{"reason":"Core dependency for generating fake data.","package":"Faker","optional":false}],"imports":[{"note":"pytest-faker provides the 'faker' fixture directly; manual Faker instantiation bypasses the plugin and may cause test isolation issues.","wrong":"from faker import Faker; fake = Faker()","symbol":"faker fixture","correct":"def test_example(faker):"}],"quickstart":{"code":"import pytest\n\ndef test_name(faker):\n    name = faker.name()\n    assert isinstance(name, str)\n\ndef test_email(faker):\n    email = faker.email()\n    assert '@' in email\n","lang":"python","description":"Write a test that uses the 'faker' fixture to generate fake data. No imports needed beyond pytest."},"warnings":[{"fix":"Rename fixture usage from 'fake' to 'faker'.","message":"Version 1.0 used 'fake' fixture; version 2.0 changed to 'faker'.","severity":"breaking","affected_versions":"1.x -> 2.0+"},{"fix":"Use 'faker.seed_instance(12345)' or the 'faker_seed' fixture.","message":"Faker's 'seed' method is deprecated; use 'seed_instance' or configure via pytest-faker's seed fixture.","severity":"deprecated","affected_versions":"All versions using Faker < 18.0"},{"fix":"Use 'faker_seed' fixture per test function to control reproducibility without cross-test contamination.","message":"The 'faker' fixture uses a new Faker instance per test by default, but seeding with 'faker_seed' can cause shared state if not careful.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install Faker","cause":"Faker library not installed; pytest-faker only depends on Faker via runtime, not install dependency.","error":"ModuleNotFoundError: No module named 'faker'"},{"fix":"Update pytest to 3.0+ or add 'pytest-faker' to pytest_plugins in conftest.py: pytest_plugins = ['pytest_faker']","cause":"Caused by using pytest-faker with pytest < 3.0 or not declaring plugin in conftest.py or pytest.ini.","error":"fixture 'faker' not found"},{"fix":"Replace with faker.seed_instance(seed_value) or use the 'faker_seed' fixture.","cause":"Using deprecated seed() method in newer versions of Faker.","error":"AttributeError: 'Faker' object has no attribute 'seed'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}