$npx skillfedfor your agent

pytest-factoryboy

Factory Boy support for pytest.

Worth itPyPI LibrariesReleased Jul 20252.8M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_factoryboy-2.8.1-py3-none-any.whl
v2.8.1 · released 2025-07-01 · Python >=3.9 · 5 runtime deps: factory_boy, inflection, packaging, pytest, typing_extensions

Yes. This is a mature, actively maintained package (first release 2015-04-09, latest 2025-07-01) with no known vulnerabilities, low install friction, and permissive MIT licensing. It solves a real pain point—combining factory_boy's declarative test data with pytest's fixture system—and is widely used (top 5000 PyPI packages). Install it if you use factory_boy and pytest together.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9 or later; factory_boy and pytest must be installed.
  • Low friction: pure Python wheel with five runtime dependencies (factory_boy, inflection, packaging, pytest, typing_extensions), all common and stable.
  • Active maintenance with latest release 2025-07-01 and no known vulnerabilities.

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.

last release 2025-07-01 (409 days) · last repo commit 2026-08-11 · 399 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,833,269 downloads/mo, #2,873 on PyPI

Verify before relying

pip install pytest-factoryboy

from pytest_factoryboy import register
import factory

@register
class AuthorFactory(factory.Factory):
    class Meta:
        model = Author
    name = "Charles Dickens"

def test_author(author):
    assert author.name == "Charles Dickens"
  • Whether the package supports factory_boy's full feature set (SubFactory, RelatedFactory, post-generation) without limitations.
  • Performance characteristics when registering many factories or running parametrized tests at scale.
Same gist for agents: .md · .json

What it is and what it does

pytest-factoryboy bridges factory_boy and pytest by automatically converting factory classes into pytest fixtures. Instead of manually instantiating test objects or writing fixture boilerplate, you register a factory once and pytest injects instances directly into test functions. The package creates both model fixtures (instances) and factory fixtures (the factory itself), plus attribute fixtures that let you override individual fields via pytest parametrization.

The integration handles factory_boy's advanced patterns: SubFactory relationships become fixture dependencies, related factories are injected automatically, and post-generation hooks work as fixtures. You can register the same factory multiple times with different names, specialize fixtures with keyword arguments during registration, and use LazyFixture to inject other fixtures as attribute values. This approach reduces boilerplate and makes test setup declarative and composable.

Use it for

  • Create reusable test fixtures for model objects without writing fixture functions.
  • Parametrize test object attributes via pytest.mark.parametrize without modifying factory definitions.
  • Build complex object graphs with SubFactory relationships that automatically resolve as fixture dependencies.
  • Register multiple instances of the same factory with different names for testing relationships between objects.
  • Override factory attributes at registration time to create specialized fixture variants for different test scenarios.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

This is a mature, actively maintained package (first release 2015-04-09, latest 2025-07-01) with no known vulnerabilities, low install friction, and permissive MIT licensing. It solves a real pain point—combining factory_boy's declarative test data with pytest's fixture system—and is widely used (top 5000 PyPI packages). Install it if you use factory_boy and pytest together.

Install

pytest-factoryboy on PyPI

Before you install

Low friction: pure Python wheel with five runtime dependencies (factory_boy, inflection, packaging, pytest, typing_extensions), all common and stable. Active maintenance with latest release 2025-07-01 and no known vulnerabilities.

Requires Python 3.9 or later; factory_boy and pytest must be installed.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install pytest-factoryboy

from pytest_factoryboy import register
import factory

@register
class AuthorFactory(factory.Factory):
    class Meta:
        model = Author
    name = "Charles Dickens"

def test_author(author):
    assert author.name == "Charles Dickens"

Verify before relying

  • Whether the package supports factory_boy's full feature set (SubFactory, RelatedFactory, post-generation) without limitations.
  • Performance characteristics when registering many factories or running parametrized tests at scale.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
5 packages
factory_boyinflectionpackagingpytesttyping_extensions
MaintenanceActively maintained 409 days since the last release
Last repo commit
First released
Downloads2,833,269 / month, #2,873 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Utilities

Evidence: pytest_factoryboy-2.8.1-py3-none-any.whl

Tags

Capabilities
pytest factory fixturesfactory_boy pytest integrationtest data factory fixturespytest dependency injectionfactory pattern testingpytest model fixturesparametrized test factories
Topics
pytest-plugintest-fixturesfactory-pattern

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest factory fixtures”

  • pytest-factoryboyIntegrates factory_boy with pytest to register factories as fixtures,…
  • pytest-printAdds fixtures to pytest that print messages directly to test output,…
  • pytest-redisA pytest plugin that provides fixtures for testing code that depends…

Give your agent the search over MCP, or paste the wish link into any chat.

More Libraries packages

urllib3 Worth it
PyPI · Libraries · released May 2026

urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.

MITpure Python · 3.10+
1.8Bdownloads / mo
requests Worth it
PyPI · Libraries · released May 2026

Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.

Apache-2.0pure Python · 3.10+
1.8Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
python-dateutil Worth it
PyPI · Libraries · released Mar 2024

Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.

Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.

Apache-2.0pure Python
1.2Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo

See also factory-boy · pytest-docker-tools · django-dynamic-fixture · pytest-faker · async-factory-boy · wagtail-factories · pytest-lazy-fixtures · model-mommy · pytest-lazy-fixture · pytest-django