Django Testing: no data in temporary database file
Question: I'm using a sqlite3 database set up as follows in `settings.py`:

    
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.contrib.gis.db.backends.spatialite',
            'NAME': 'path/to/config.sqlite',
            'TEST_NAME': 'path/to/test-config.sqlite',
            # ... USER, PASSWORD and PORT left out for brevity
        }
    }
    

During a test run started with:

    
    
    python manage.py test myapp.mytest
    

this temporarily creates a database file `path/to/test-config.sqlite` which I
need in another application loaded with the required fixtures.

The database file however is empty, which I asserted during a pause in one
test:

    
    
    sqlite> select * from someapp_somemodel;
    
    ... no results here :(
    

Other test cases which do not require a sqlite file and for which the in-
memory database suffices, no errors occurs.

My questions:

  * Why doesn't django flush its data to the database file if it creates it anyway? and
  * How can I convince django to do it, as I require the data to be dumped in the temporary database file?

**EDIT**

I'm using Django 1.3.1, if thats of any interest.

**EDIT2**

I'm familiar with fixtures, and I use them to populate the database, but my
problem is that the data from the fixtures is not written to the database file
during the test. Sorry if I wasn't clear enough on that fact.

**EDIT3**

As my question needs some clarification, please consider the following test
setup (which is close to what I'm actually doing):

    
    
    class SomeTestCase(django.test.TestCase):
        fixtures = ["some_fixture.json", "some_other_fixture.json"]
    
        def testSomething(self):
            import pdb; pdb.set_trace()
    

When the `testSomething` method runs into the breakpoint I start up the
`sqlite3` program and connect to the temporary database file created by
Django. The fixtures are loaded (which I know, because other tests work
aswell) but the data is not written to the temporary database file.


Answer: Have you run the initial syncdb to create the database tables? (**python
yourproject/manage.py syncdb**)

In your settings.py, what apps do you have installed under INSTALLED_APPS?

In your project, what models have you built?

Depending on what apps you have installed in INSTALLED_APPS and what custom
models you have added to your project, will dictate what databases syncdb will
create.

