Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made TestNoInitialDataLoading pass with MySQL (Refs #15926)

  • Loading branch information...
commit f0664dc8ae541b21e3cf421725e7933a9b3a799e 1 parent 7edf231
Claude Paroz authored June 06, 2012
5  django/core/management/commands/flush.py
@@ -81,9 +81,8 @@ def handle_noargs(self, **options):
81 81
             # Reinstall the initial_data fixture.
82 82
             kwargs = options.copy()
83 83
             kwargs['database'] = db
84  
-            if options.get('load_initial_data', True):
85  
-            # Reinstall the initial_data fixture.
86  
-                from django.core.management import call_command
  84
+            if options.get('load_initial_data'):
  85
+                # Reinstall the initial_data fixture.
87 86
                 call_command('loaddata', 'initial_data', **options)
88 87
 
89 88
         else:
4  django/core/management/commands/syncdb.py
@@ -2,6 +2,7 @@
2 2
 import traceback
3 3
 
4 4
 from django.conf import settings
  5
+from django.core.management import call_command
5 6
 from django.core.management.base import NoArgsCommand
6 7
 from django.core.management.color import no_style
7 8
 from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
@@ -27,7 +28,7 @@ def handle_noargs(self, **options):
27 28
         verbosity = int(options.get('verbosity'))
28 29
         interactive = options.get('interactive')
29 30
         show_traceback = options.get('traceback')
30  
-        load_initial_data = options.get('load_initial_data', True)
  31
+        load_initial_data = options.get('load_initial_data')
31 32
 
32 33
         self.style = no_style()
33 34
 
@@ -158,6 +159,5 @@ def model_installed(model):
158 159
 
159 160
         # Load initial_data fixtures (unless that has been disabled)
160 161
         if load_initial_data:
161  
-            from django.core.management import call_command
162 162
             call_command('loaddata', 'initial_data', verbosity=verbosity,
163 163
                          database=db, skip_validation=True)
27  tests/modeltests/fixtures_model_package/tests.py
@@ -27,34 +27,12 @@ def test_syncdb(self):
27 27
         management.call_command(
28 28
             'syncdb',
29 29
             verbosity=0,
30  
-            commit=False
31  
-        )
32  
-        self.assertQuerysetEqual(
33  
-            Book.objects.all(), [
34  
-                u'Achieving self-awareness of Python programs'
35  
-            ],
36  
-            lambda a: a.name
37  
-        )
38  
-
39  
-        Book.objects.all().delete()
40  
-
41  
-        management.call_command(
42  
-            'syncdb',
43  
-            verbosity=0,
44  
-            commit=False,
45 30
             load_initial_data=False
46 31
         )
47 32
         self.assertQuerysetEqual(Book.objects.all(), [])
48 33
 
49 34
     def test_flush(self):
50  
-        Book.objects.all().delete()
51  
-
52  
-        management.call_command(
53  
-            'flush',
54  
-            verbosity=0,
55  
-            interactive=False,
56  
-            commit=False
57  
-        )
  35
+        # Test presence of fixture (flush called by TransactionTestCase)
58 36
         self.assertQuerysetEqual(
59 37
             Book.objects.all(), [
60 38
                 u'Achieving self-awareness of Python programs'
@@ -62,12 +40,9 @@ def test_flush(self):
62 40
             lambda a: a.name
63 41
         )
64 42
 
65  
-        Book.objects.all().delete()
66  
-
67 43
         management.call_command(
68 44
             'flush',
69 45
             verbosity=0,
70  
-            commit=False,
71 46
             interactive=False,
72 47
             load_initial_data=False
73 48
         )

0 notes on commit f0664dc

Please sign in to comment.
Something went wrong with that request. Please try again.