Opened 4 years ago

Closed 4 years ago

#32756 closed Uncategorized (invalid)

Inconsistent TestCase results with fixtures

Reported by: Alexandr Bezenkov Owned by: nobody
Component: Testing framework Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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?

Change History (2)

comment:1 by Alexandr Bezenkov, 4 years ago

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.

comment:2 by Alexandr Bezenkov, 4 years ago

Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.
Back to Top