Extraction test is broken
Categories
(Tree Management :: Treeherder: Data Ingestion, defect)
Tracking
(Not tracked)
People
(Reporter: ekyle, Unassigned)
Details
Attachments
(1 file)
This code used to create an object with the given dates
https://github.com/mozilla/treeherder/blob/master/tests/extract/conftest.py#L154
bcf = ClassifiedFailure.objects.create(
**{
"bug_number": 1234567,
"created": Date("2020-01-17 12:00:00").datetime,
"modified": Date("2020-01-17 12:00:00").datetime,
}
)
this no longer happens
Reporter | ||
Comment 2•5 years ago
|
||
The problem appears here, exactly on the self.raw = raw
line the objs[0].created
and objs[0].modified
properties go from the given (January) date to the current (May) date.
https://github.com/django/django/blob/stable/3.0.x/django/db/models/sql/subqueries.py#L181
def insert_values(self, fields, objs, raw=False):
self.fields = fields
self.objs = objs
self.raw = raw
It is interesting that the raw
is not a declared property. It makes me assume there is another system that detects when self.raw
is assigned False
and then updates the objs
. There are other threads running, but I was unable to breakpoint them
Reporter | ||
Comment 3•5 years ago
|
||
It appears django has some nifty obfuscation code. Maybe this is the culprit:
pre_save = ModelSignal(providing_args=["instance", "raw", "using", "update_fields"], use_caching=True)
Reporter | ||
Comment 4•5 years ago
|
||
I have traced the problem to pre_save()
https://github.com/django/django/blob/stable/3.0.x/django/db/models/fields/__init__.py#L1343
which is following the rules declared in the migration
So, the behaviour is correct now, but was wrong before.
Reporter | ||
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Description
•