zsoldosp / django-currentuser

Conveniently store reference to request user on thread/db level.
BSD 3-Clause "New" or "Revised" License
139 stars 40 forks source link

Avoid warning for clone of field for running tests #4

Closed belugame closed 6 years ago

belugame commented 6 years ago

Django clones fields (leads to re-init with forbidden kwargs) when running tests and that triggers the warning for no good reason. Not a perfect solution but at that scope it seems there is nothing else to determine a 2nd init.

zsoldosp commented 6 years ago

hmm, and there is an explicit test for it testapp.tests.CurrentUserFieldTestCase.test_warning_is_raised_when_forbidden_arguments_are_passed...

IIRC it also came up during migrations, where there was some workaround...

without having looked at the implementation, my initial ideas are

2c only

belugame commented 6 years ago

Thank you for your suggestions and sorry, had to postphone this bit of work for while.

check that the passed values match the default, and if so, don't raise

That's a good idea, and probably the easiest solution too. I will add a new MR for that.