pytest-dev / pytest-dev/pytest-factoryboy

Factory.build fixtures

Open
#56 8 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
400
Forks
44
Avg merge
6h 34m
Merged PRs (30d)
1

Description

Might be worth adding fixtures for creating models with build instead of create

I know this exists because I've used FactoryBot in Rails and I knew to look for it, but others might not, and it's probably worth nudging people towards writing non-db tests when they can

If I've understood correctly, currently the only way to build is to use the factory fixture and call build?

def test(asset_factory):
    asset = asset_factory.build()

Automatically registering fixtures like asset_build or similar might be a way to go. Thoughts?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name files or tests. Start by tracing how the existing factory fixture is registered and how its build() method is used, then determine the intended naming and registration behavior for build fixtures and add coverage showing that the resulting models avoid database creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.