Skip to content

Conversation

@jrobichaud
Copy link
Contributor

@jrobichaud jrobichaud commented Mar 11, 2024

I found this bug and I made a PR to add a failing test.

According to the doc we should be allowed to chain Traits.

However when chaining traits we cannot have a reference to a SubFactory of a RelatedFactory.

The error I get is:

factory.errors.InvalidDeclarationError: Received deep context for unknown fields: {'nested__two': Maybe(<SelfAttribute('with_related_nested_override', default=False)>, yes=2, no=<factory.declarations.Skip object at 0x103bcd040>)} (known=[])

@jrobichaud jrobichaud changed the title Add failing test for traits chaining with RelatedFactory and SubFactory Add failing test for traits chaining along with RelatedFactory and SubFactory Mar 12, 2024
@francoisfreitag
Copy link
Member

Sweet, thanks for taking the time to submit this report with an example to reproduce! ⭐
It definitely increases the chances of someone picking this up, and clarifies the issue.

The fix might also solve #533, or #542.

@jrobichaud
Copy link
Contributor Author

This suggested solution of #542 does not fix the problem and results in an additional failing test.

The attribute “two” is not used. Show the override using different values.
@francoisfreitag francoisfreitag force-pushed the traits-related-nested-override branch 2 times, most recently from ae82722 to 229d11e Compare March 24, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants