Skip to main content

Automatic test scaffolding and mock generation for Python

Project description

pytest-forger

Version: 0.0.1
Status: Early placeholder release (name reservation on PyPI)


What is pytest-forger?

pytest-forger is a Python tool designed to forge PyTest-ready tests from existing Python source code.

The goal of the project is to reduce the friction and boilerplate involved in writing tests by automatically generating test scaffolding and mocks based on the structure of your code, while keeping the developer fully in control of the final behavior.

This initial release (v0.0.1) exists primarily to reserve the project name and clearly define the vision and scope of the project.


Project Vision

Writing tests is essential, but writing test boilerplate is often repetitive, time-consuming, and discouraging—especially in service-oriented architectures with repositories, external services, and layered dependencies.

pytest-forger aims to:

  • Analyze Python source code statically
  • Detect function and method dependencies
  • Identify external boundaries (repositories, services, adapters)
  • Automatically generate:
    • PyTest test files
    • Mocked dependencies
    • Executable test scaffolding

pytest-forger does not attempt to guess business logic or replace human reasoning.
Instead, it focuses on automating the mechanical and structural parts of testing.


Design Principles

pytest-forger is built around a few core principles:

  • Automation without magic
    Generated tests should be explicit, readable, and predictable.

  • Structure over semantics
    The tool understands code structure, not business intent.

  • Mocks at the boundaries
    External dependencies are mocked; internal logic remains real.

  • Developer ownership
    Generated tests are meant to be edited, extended, and owned by the developer.


Intended Use Cases

pytest-forger is especially useful for:

  • Service layers calling repositories or other services
  • Legacy codebases with little or no test coverage
  • Quickly bootstrapping tests for refactoring
  • Teams that want consistency in test structure
  • Developers who want to avoid repetitive PyTest boilerplate

What pytest-forger Is Not

To set clear expectations, pytest-forger is not:

  • A replacement for test design
  • A business-logic inference engine
  • A fully autonomous test generator
  • A PyTest plugin (at least initially)

pytest-forger generates starting points, not perfect tests.


Planned Capabilities (Future Versions)

These features are planned, not yet implemented:

  • Static analysis of function and method call graphs
  • Automatic mock generation for:
    • Repositories
    • External services
    • Imported functions
  • Minimal factory generation based on return type hints
  • PyTest-compatible test scaffolding
  • CLI interface for test generation
  • Configurable mock policies
  • Optional integrations with LLMs for test suggestions (future)

Current Status

Version 0.0.1

  • Placeholder release
  • Name reservation on PyPI
  • No functional implementation yet
  • API and architecture subject to change

Development will begin after this initial release.


Roadmap (High-Level)

  • 0.1.x — Core static analysis and test scaffolding
  • 0.2.x — Mock generation and configuration
  • 0.3.x — Factories and improved type handling
  • 0.4.x+ — Advanced features and integrations

Philosophy

pytest-forger exists to answer one simple question:

“How much of testing can we automate without lying to ourselves?”

The answer is: a lot of the boring parts.


License

MIT License


Disclaimer

pytest-forger is an early-stage project under active design.
Breaking changes are expected in early versions.


Forge tests, not excuses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_forger-0.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_forger-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_forger-0.0.1.tar.gz.

File metadata

  • Download URL: pytest_forger-0.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pytest_forger-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7be08249496bd09140c44e3664713309530944cee2f5de24e544217f0461ef4d
MD5 81e1970d5a03d7a7bf0089a8432c41de
BLAKE2b-256 7463c7c2424e2058907e49e786d01b41501efb6b78fec2fa5ed7d4d2e31086e8

See more details on using hashes here.

File details

Details for the file pytest_forger-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_forger-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pytest_forger-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9091911255428686471078ec5542744fd44c69518d5edaa8f63bea127714e12
MD5 e1050593ed82afff7e89728b33aef8e5
BLAKE2b-256 3d44b057bf199a4d6d71c4725c6ccd4de8d7eb2674a4324138d7fa3c806f1f2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page