Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is a comment on #416 which we contributed to, but is now closed #487

Closed
paulredman- opened this issue Aug 9, 2024 · 7 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@paulredman-
Copy link

We have a test suite of nearly 7000 tests, using model_bakery extensively.

We have a small patch for #416 which works on all versions from 1.12 -> 1.18.2 (the patch varies slightly as the code changes, but essentially looks like:
if BAKER_CONTENTTYPES:
other_fields_to_skip += [GenericForeignKey, GenericRelation]

On both 1.18.3 / 1.19.0, recently released we get early test failures (within the first 20 tests, so likely many failures)

I appreciate this bug report is not precise. It is frustrating that 1.18.3 is the first to fix our problem, but breaks other tests.

I am happy to dig deeper, if you could let me know what else changed from 1.18.2 -> 1.18.3 which might be causing problems.

Versions

  • Python: [e.g. 3.10]
  • Django [e.g. 5.x]
  • Model Bakery [e.g. 1.18.2]
@amureki
Copy link
Collaborator

amureki commented Aug 9, 2024

Greetings!

Thank you for the report!
This is indeed a massive test codebase, I am sorry that certain things are broken there.
Let's try to figure this out!

The latest changes related to GFK are covered in the following commit (1.18.3):
0b4cfa7

The mentioned patch (that simply adds a GFK to a skip list) will break a case where iter is used together with GFK:
TestFillingGenericForeignKeyField.test_iteratively_filling_generic_foreign_key_field

Would it be possible to craft a small reproducible test structure?

Best,
Rust

@amureki amureki added the bug Something isn't working label Aug 9, 2024
@amureki
Copy link
Collaborator

amureki commented Aug 16, 2024

Hey @paulredman- !

I released 1.19.2 with a couple of patches adjusting the behaviour of GFK fields.
Would you be so kind to try it out?

Best,
Rust

@amureki amureki self-assigned this Aug 16, 2024
@paulredman-
Copy link
Author

paulredman- commented Aug 16, 2024 via email

@amureki
Copy link
Collaborator

amureki commented Aug 17, 2024

Many thanks for the provided stacktrace, this helps alot!

I have drafted #496 to address this bug; however, it would not prevent content_type and object_id from generating random values in case they are not nullable, but content_object is None.
(This was never a case before either, so I am not sure how critical it is to cover now - as it is not easy).

@amureki
Copy link
Collaborator

amureki commented Aug 17, 2024

@paulredman-
Copy link
Author

paulredman- commented Aug 21, 2024 via email

@amureki
Copy link
Collaborator

amureki commented Aug 21, 2024

@paulredman- hey Paul,
thanks for getting back and many thanks for all the cooperation and reports you made 👍 . That helped a lot!

Glad that it is resolved for you.

@amureki amureki closed this as completed Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants