Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made TestNoInitialDataLoading pass with MySQL (Refs #15926)

  • Loading branch information...
commit f0664dc8ae541b21e3cf421725e7933a9b3a799e 1 parent 7edf231
@claudep claudep authored
View
5 django/core/management/commands/flush.py
@@ -81,9 +81,8 @@ def handle_noargs(self, **options):
# Reinstall the initial_data fixture.
kwargs = options.copy()
kwargs['database'] = db
- if options.get('load_initial_data', True):
- # Reinstall the initial_data fixture.
- from django.core.management import call_command
+ if options.get('load_initial_data'):
+ # Reinstall the initial_data fixture.
call_command('loaddata', 'initial_data', **options)
else:
View
4 django/core/management/commands/syncdb.py
@@ -2,6 +2,7 @@
import traceback
from django.conf import settings
+from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
@@ -27,7 +28,7 @@ def handle_noargs(self, **options):
verbosity = int(options.get('verbosity'))
interactive = options.get('interactive')
show_traceback = options.get('traceback')
- load_initial_data = options.get('load_initial_data', True)
+ load_initial_data = options.get('load_initial_data')
self.style = no_style()
@@ -158,6 +159,5 @@ def model_installed(model):
# Load initial_data fixtures (unless that has been disabled)
if load_initial_data:
- from django.core.management import call_command
call_command('loaddata', 'initial_data', verbosity=verbosity,
database=db, skip_validation=True)
View
27 tests/modeltests/fixtures_model_package/tests.py
@@ -27,34 +27,12 @@ def test_syncdb(self):
management.call_command(
'syncdb',
verbosity=0,
- commit=False
- )
- self.assertQuerysetEqual(
- Book.objects.all(), [
- u'Achieving self-awareness of Python programs'
- ],
- lambda a: a.name
- )
-
- Book.objects.all().delete()
-
- management.call_command(
- 'syncdb',
- verbosity=0,
- commit=False,
load_initial_data=False
)
self.assertQuerysetEqual(Book.objects.all(), [])
def test_flush(self):
- Book.objects.all().delete()
-
- management.call_command(
- 'flush',
- verbosity=0,
- interactive=False,
- commit=False
- )
+ # Test presence of fixture (flush called by TransactionTestCase)
self.assertQuerysetEqual(
Book.objects.all(), [
u'Achieving self-awareness of Python programs'
@@ -62,12 +40,9 @@ def test_flush(self):
lambda a: a.name
)
- Book.objects.all().delete()
-
management.call_command(
'flush',
verbosity=0,
- commit=False,
interactive=False,
load_initial_data=False
)
Please sign in to comment.
Something went wrong with that request. Please try again.