pytest-dev / pytest-dev/pytest-factoryboy
RelatedFactory is not working inside fixtures
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 400
- Forks
- 44
- Avg merge
- 6h 34m
- Merged PRs (30d)
- 1
Description
How to reproduce (just one step):
to test https://github.com/pytest-dev/pytest-factoryboy/blob/master/tests/test_circular.py
add
@pytest.fixture(autouse=True)
def autouse_fixture_check(author):
assert author.books
Output:
E
test setup failed
author = <test.Author object at 0x10a426dd0>
@pytest.fixture(autouse=True)
def autouse_fixture_check(author):
> assert author.books
E assert []
E + where [] = <test.Author object at 0x10a426dd0>.books
test.py:53: AssertionError
Broken versions: >= 2.0.1, <= 2.0.3 (current)
Last version that works: 1.3.2
Example setup for working version:
pip install pytest==3.10.1 factory-boy==2.8.1 pytest-factoryboy==1.3.2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in tests/test_circular.py with the added autouse fixture and the listed pytest, factory-boy, and pytest-factoryboy versions. Trace how RelatedFactory and fixtures are set up, then add a regression check showing that author.books is populated and run the circular fixture tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100