[Django] #32756: Inconsistent TestCase results with fixtures

11 views
Skip to first unread message

Django

unread,
May 18, 2021, 2:14:17 AM5/18/21
to django-...@googlegroups.com
#32756: Inconsistent TestCase results with fixtures
---------------------------------------------+------------------------
Reporter: Alexandr Bezenkov | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
I've created a TestCase for one of my apps which uses fixtures:

{{{
from django.test.testcases import TestCase

class EmployeesTestCase(TestCase):
fixtures = [
'capps/accounts/fixtures/tests',
'capps/locations/fixtures/tests',
'capps/companies/fixtures/tests',
'employees/fixtures/tests',
]
...
}}}
Everything is fine except one thing: sometimes testcase fails with error
**json.decoder.JSONDecodeError: Problem installing fixture**.
Here's the link to the video demonstrating the issue
https://youtu.be/GqMarU0_XW0
Tried with both Django 3.2.2 and 3.2.3, with python 3.8.9 and 3.9.5, with
PostgreSQL 13 and SQLite 3.
All fixtures were created by {{{python manage.py dumpdata }}}.
This is the case for all apps in my project, it either loads data, or
fails to do so without any change from my side.
Can someone please explain what kind of black magic is this?

--
Ticket URL: <https://code.djangoproject.com/ticket/32756>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 18, 2021, 2:23:33 AM5/18/21
to django-...@googlegroups.com
#32756: Inconsistent TestCase results with fixtures
-----------------------------------+--------------------------------------

Reporter: Alexandr Bezenkov | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by Alexandr Bezenkov):

NOTE: also tried **yaml** and **jsonl** formats, the error is the same
even if I try

{{{
from django.test.testcases import TestCase

class EmployeesTestCase(TestCase):
fixtures = [
'capps/accounts/fixtures/tests.yaml',
'capps/locations/fixtures/tests.yaml',
'capps/companies/fixtures/tests.yaml',
'employees/fixtures/tests.yaml',
]
...
}}}
And yes everything worked with Django 2.2.23.

--
Ticket URL: <https://code.djangoproject.com/ticket/32756#comment:1>

Django

unread,
May 18, 2021, 2:40:22 AM5/18/21
to django-...@googlegroups.com
#32756: Inconsistent TestCase results with fixtures
-----------------------------------+--------------------------------------

Reporter: Alexandr Bezenkov | Owner: nobody
Type: Uncategorized | Status: closed

Component: Testing framework | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Alexandr Bezenkov):

* status: new => closed
* resolution: => invalid


Comment:

Nevermind, it was post save signal that messed with the actual import.

--
Ticket URL: <https://code.djangoproject.com/ticket/32756#comment:2>

Reply all
Reply to author
Forward
0 new messages