Ejemplo n.º 1
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     if hasattr(self, 'installed_apps'):
         hacks.store_app_cache_state()
         hacks.set_installed_apps(self.installed_apps)
Ejemplo n.º 2
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     if hasattr(self, 'installed_apps'):
         hacks.store_app_cache_state()
         hacks.set_installed_apps(self.installed_apps)
Ejemplo n.º 3
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     if hasattr(self, 'installed_apps'):
         hacks.store_app_cache_state()
         hacks.set_installed_apps(self.installed_apps)
         # Make sure dependencies are calculated for new apps
         Migrations._dependencies_done = False
Ejemplo n.º 4
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     if hasattr(self, 'installed_apps'):
         hacks.store_app_cache_state()
         hacks.set_installed_apps(self.installed_apps)
         # Make sure dependencies are calculated for new apps
         Migrations._dependencies_done = False
Ejemplo n.º 5
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()
Ejemplo n.º 6
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()
Ejemplo n.º 7
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     if getattr(self, 'installed_apps', None):
         hacks.set_installed_apps(self.installed_apps)
Ejemplo n.º 8
0
 def setUp(self):
     """
     Changes the Django environment so we can run tests against our test apps.
     """
     hacks.set_installed_apps(["fakeapp", "otherfakeapp"])