pytest-dev / pytest-dev/pytest-factoryboy

Registered Django factories don't call overridden classmethod _create

Open
#63 0 comments 0 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

It seems only the _create of the parent class (factory.django.DjangoModelFactory._create) is called when using a pytest-factoryboy fixture in a test. Using the Factory() class directly works fine (does indeed call the Factory._create classmethod).

I'll try to add a test case, but it will require adding a bunch of new requirements if we want to test it for a real Django model factory.

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

Start by reproducing the difference between a registered pytest-factoryboy fixture and direct Factory() use, focusing on which _create classmethod is invoked. Add a regression test for the overridden classmethod; the issue notes that testing with a real Django model factory may require additional requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.