Example #1
0
 def tearDown(self):
     """
     Undoes what setUp did.
     """
     if hasattr(self, 'installed_apps'):
         hacks.reset_installed_apps()
         hacks.restore_app_cache_state()
Example #2
0
 def tearDown(self):
     """
     Undoes what setUp did.
     """
     if hasattr(self, 'installed_apps'):
         hacks.reset_installed_apps()
         hacks.restore_app_cache_state()
Example #3
0
 def load_initial_data(self, target, db='default'):
     if target is None or target != target.migrations[-1]:
         return
     # Load initial data, if we ended up at target
     if self.verbosity:
         print(" - Loading initial data for %s." % target.app_label())
     # Override Django's get_apps call temporarily to only load from the
     # current app
     hacks.set_installed_apps([ia for ia in settings.INSTALLED_APPS if ia.split(".")[-1] == target.app_label()], preserve_models=True)
     try:
         call_command('loaddata', 'initial_data', verbosity=self.verbosity, database=db)
     finally:
         hacks.reset_installed_apps()
Example #4
0
 def load_initial_data(self, target, db='default'):
     if target is None or target != target.migrations[-1]:
         return
     # Load initial data, if we ended up at target
     if self.verbosity:
         print(" - Loading initial data for %s." % target.app_label())
     # Override Django's get_apps call temporarily to only load from the
     # current app
     hacks.set_installed_apps([
         ia for ia in settings.INSTALLED_APPS
         if ia.split(".")[-1] == target.app_label()
     ],
                              preserve_models=True)
     try:
         call_command('loaddata',
                      'initial_data',
                      verbosity=self.verbosity,
                      database=db)
     finally:
         hacks.reset_installed_apps()
Example #5
0
 def tearDown(self):
     """
     Undoes what setUp did.
     """
     if getattr(self, 'installed_apps', None):
         hacks.reset_installed_apps()
Example #6
0
 def tearDown(self):
     """
     Undoes what setUp did.
     """
     hacks.reset_installed_apps()