Registry / testing / pytest-faker

pytest-faker

JSON →
library2.0.0pypypiunverified

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.

pip install pytest-faker
INSTALL
IMPORT
SIG · PYTEST-FAKER
P
pytest-faker
testingpythonv2.0.0
Install
3.7s avg
Import
Disk
41MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 43.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.7s · import 0.000s · 44MB
41MB installed
● package 41MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

faker fixture
def test_example(faker):
from faker import Faker; fake = Faker()
pytest-faker provides the 'faker' fixture directly; manual Faker instantiation bypasses the plugin and may cause test isolation issues.

Write a test that uses the 'faker' fixture to generate fake data. No imports needed beyond pytest.

import pytest def test_name(faker): name = faker.name() assert isinstance(name, str) def test_email(faker): email = faker.email() assert '@' in email
Debug
Known issues
breakingVersion 1.0 used 'fake' fixture; version 2.0 changed to 'faker'.
fix
Rename fixture usage from 'fake' to 'faker'.
affects: 1.x -> 2.0+
deprecatedFaker's 'seed' method is deprecated; use 'seed_instance' or configure via pytest-faker's seed fixture.
fix
Use 'faker.seed_instance(12345)' or the 'faker_seed' fixture.
affects: All versions using Faker < 18.0
gotchaThe 'faker' fixture uses a new Faker instance per test by default, but seeding with 'faker_seed' can cause shared state if not careful.
fix
Use 'faker_seed' fixture per test function to control reproducibility without cross-test contamination.
affects: All versions
Upgrade
Version history
2.0.0latest on PyPI · released Dec 19, 2016
Audit
Dependencies
pytestrequiredpytest-faker is a pytest plugin; requires pytest to run.
FakerrequiredCore dependency for generating fake data.
Agent activity
13 hits · last 30 days
node
12
Resources
pytest-faker — pip install pytest-faker · libregistry