adamchainz/django-perf-rec

Is django-perf-rec work with "delete" queries relative to an object ? django < 1.9 only

moumoutte opened this issue · 3 comments

I'm asking this question because when using it in our projects I'm actually tracking a "delete view" on a specific object and django-perf-rec logs "DELETE queries" with different order.

When I dig a little bit in django implementation of deleting on cascade object , I actually found that the collector which tracks objects to delete store values inside a Set() through this function

https://github.com/django/django/blob/1.8.17/django/db/models/deletion.py#L61

In my case (with six differents attributes) , it returns a list with unpredictable order, and cause a diff in the file create by django-perf-rec.

I would like to know if my conclusion seems good to your eyes , if you knew about it, and if there are workaround in order to make it.

Many thxs.

You seem to be right. Perhaps we can add a patchy-patch to make it deterministic like we do in https://github.com/YPlan/django-perf-rec/blob/master/django_perf_rec/orm.py#L10 .

Can you open a PR with at least a test case, if not the patch? 😄

sure many thanks for your fast reaction :)

Fixed in #57 , thanks!