pytest-dev / pytest-dev/pytest-factoryboy

Parametrized traits are not called from fixture in overriden Factory

Open
#98 3 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

The general way to reproduce this is:

  1. I have a Django Model with a method
  2. I create a factory for that model with factory.django.DjangoModelFactory
  3. I register a trait using factory.PostGenerationMethodCall
  4. I make a subclass of that factory
  5. I register a factory for that subclass

If I use the factory in a test, the method will not be called.

If I make a pytest fixture manually, calling the overridden factory directly, the method is called.

Since it's an involved case, I'll try to come up with a minimal example to reproduce this on github and reference this issue.

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

Reproduce the five-step scenario with a Django model, DjangoModelFactory, PostGenerationMethodCall, an overridden factory, and a pytest fixture. Compare the fixture's overridden-factory path with calling that factory directly; done means the registered method is called when the factory is used in a test, with a minimal example documenting the failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.