def test_custom_swappable_manager(self):
        try:
            # This test adds dummy models to the app cache. These
            # need to be removed in order to prevent bad interactions
            # with the flush operation in other tests.
            old_app_models = copy.deepcopy(cache.app_models)
            old_app_store = copy.deepcopy(cache.app_store)

            settings.TEST_SWAPPABLE_MODEL = 'managers_regress.Parent'

            class SwappableModel(models.Model):

                stuff = models.Manager()

                class Meta:
                    swappable = 'TEST_SWAPPABLE_MODEL'

            # Accessing the manager on a swappable model with an
            # explicit manager should raise an attribute error with a
            # helpful message
            try:
                SwappableModel.stuff.all()
                self.fail('Should raise an AttributeError')
            except __HOLE__ as e:
                self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'")

        finally:
            del settings.TEST_SWAPPABLE_MODEL
            cache.app_models = old_app_models
            cache.app_store = old_app_store
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_custom_swappable_manager