Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1026981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:10:06+00:00 2026-05-16T12:10:06+00:00

I am testing my application and I am running into an issue and I’m

  • 0

I am testing my application and I am running into an issue and I’m not sure why. I’m loading fixtures for my tests and the fixtures have foreign keys that rely on each other. They must be loaded in a certain order or it won’t work.

The fixtures I’m loading are:

["test_company_data", "test_rate_index", 'test_rate_description']

Company data is the first one. test_rate_index has a foreign key to company, and test_rate_description has a foreign key to a model declared in test_rate_index. (as an aside, different test need different fixtures which is why I’m not just shoving everything in one)

If I use django’s standard procedure for loading tests, the tests do not load in the proper order.

class TestPackages(test.TestCase):
    fixtures = ["test_company_data", "test_rate_index", "test_rate_description",]

I get the message

DoesNotExist: RateDescription matching query does not exist.

But if I reverse the order of my fixtures (which makes no sense) it works:

fixtures = ["test_rate_description", "test_company_data", "test_rate_index",]

Django’s documentation states that the fixtures load in the order they are declared, but this doesn’t seem to be the case.

As a workaround, instead of using django’s

    call_command('loaddata', *fixtures, **{
                                            'verbosity': 0,
                                            'commit': False,
                                            'database': 'default'
                                         })

I’m using a different function in the setUp method that loads the fixtures one at a time.

def load_fixtures(fixtures):
    for fixture in fixtures:
        call_command('loaddata', fixture, **{
                                            'verbosity': 0,
                                            'commit': False,
                                            'database': 'default'
                                            })

Is there something I’m doing incorrectly or not understanding that is causing my fixtures not to be loaded in the proper order when trying to use the standard method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:10:06+00:00Added an answer on May 16, 2026 at 12:10 pm

    Django’s documentation states that the fixtures load in the order they are declared, but this doesn’t seem to be the case.

    This is certainly strange. Fixtures are getting loaded in the proper order when I tested one of my projects (Django 1.2.1, Python 2.6.2, Postgresql 8.3.11).

    Here is what I’d do to troubleshoot.

    DoesNotExist: RateDescription matching query does not exist.

    1. Are you getting this error when loading a fixture or when executing a test? Can you find the fixture/code that is raising this? Increase verbosity if need be.

    2. Can you try firing a loaddata command from the command line? Call it three times, passing the name of one fixture for each call in the proper expected sequence. And see if the fixtures get loaded.

    3. I know you’d probably have done this already but can you make sure that the first and second fixtures do not contain any RateDescription data?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you guys are unit testing an application that relies on values from an
I am unit testing a .NET application (.exe) that uses an app.config file to
I am working with Rails fixtures for testing my rails application. It is all
I am introducing automated integration testing to a mature application that until now has
I've been testing an application using my machine as a server, and everything's going
I am testing an application which communicates to a server via a UDP port,
I'm testing out my application with the hopes of migrating to SQL Server 2008
I am stress testing a .NET web application. I did this for 2 reasons:
We're testing our ClickOnce deployed application internally on IIS (Internet Information Services), but we're
I'm about to start testing an intranet web application. Specifically, I've to determine the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.