Modify

Ticket #433 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Extract syncdb patching to separate function

Reported by: philip@… Owned by: andrew
Priority: major Milestone: 0.7.1
Component: commands Version: mercurial
Keywords: Cc:

Description

I have some code that manually calls the following to create a test database.

from django.db import connection
connection.creation.create_test_db(0)

When using South, it turns out that you need to update what "syncdb" points to. South does this twice, in the test and testserver management server commands.

I'd like to propose to extract that common code into a function, which can be called easily by end users as well.

I'm attaching a simple patch. I've tested it in my own code. I've also run South's own tests. In those, the same 4 tests fail with my change and without it. Test output attached.

BTW: you might want to update http://south.aeracode.org/wiki/Contributing to mention that "SKIP_SOUTH_TESTS = False" must be put into settings.py, else the tests won't run silently.

Attachments

patch (3.9 KB) - added by philip@… 4 years ago.
test_output (5.6 KB) - added by philip@… 4 years ago.

Change History

Changed 4 years ago by philip@…

Changed 4 years ago by philip@…

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.7.1

Yup, the patch looks good, and has the same results before and after (one test failure here, which I need to fix), so it's applied as [b6fa8b132761].

Also updated that wiki page to do as you suggest (turning off South by default hasn't been released yet, but the change is harmless if you have an older version).

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.