summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-11 22:19:19 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-17 10:17:44 +0100
commit9217b89da3295116a098ae2a071a3c4a64a0a5d0 (patch)
tree88eb0884efa3b0bdbf6107113045f5e62f6c19ce /tests
parent860c2c8bc5c77194c41464655851379bf512a052 (diff)
Removed BaseAppCache.app_store.
It was only storing redundant information. This is part of the effort to allow applications without a models module.
Diffstat (limited to 'tests')
-rw-r--r--tests/app_loading/tests.py2
-rw-r--r--tests/invalid_models/tests.py2
-rw-r--r--tests/managers_regress/tests.py6
-rw-r--r--tests/migrations/test_commands.py2
-rw-r--r--tests/migrations/test_writer.py20
-rw-r--r--tests/proxy_model_inheritance/tests.py2
-rw-r--r--tests/proxy_models/tests.py2
-rw-r--r--tests/tablespaces/tests.py2
8 files changed, 7 insertions, 31 deletions
diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py
index 4795ca4139..a8a5ba120f 100644
--- a/tests/app_loading/tests.py
+++ b/tests/app_loading/tests.py
@@ -20,12 +20,10 @@ class EggLoadingTest(TestCase):
# need to be removed in order to prevent bad interactions
# with the flush operation in other tests.
self.old_app_models = copy.deepcopy(cache.app_models)
- self.old_app_store = copy.deepcopy(cache.app_store)
def tearDown(self):
sys.path = self.old_path
cache.app_models = self.old_app_models
- cache.app_store = self.old_app_store
def test_egg1(self):
"""Models module can be loaded from an app in an egg"""
diff --git a/tests/invalid_models/tests.py b/tests/invalid_models/tests.py
index 2f7815f96d..46b3dc4c2e 100644
--- a/tests/invalid_models/tests.py
+++ b/tests/invalid_models/tests.py
@@ -23,11 +23,9 @@ class InvalidModelTestCase(unittest.TestCase):
# need to be removed in order to prevent bad interactions
# with the flush operation in other tests.
self.old_app_models = copy.deepcopy(cache.app_models)
- self.old_app_store = copy.deepcopy(cache.app_store)
def tearDown(self):
cache.app_models = self.old_app_models
- cache.app_store = self.old_app_store
cache._get_models_cache = {}
sys.stdout = self.old_stdout
diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py
index 11ad52ce44..25717f7431 100644
--- a/tests/managers_regress/tests.py
+++ b/tests/managers_regress/tests.py
@@ -115,7 +115,6 @@ class ManagersRegressionTests(TestCase):
# 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)
class SwappableModel(models.Model):
class Meta:
@@ -131,7 +130,6 @@ class ManagersRegressionTests(TestCase):
finally:
cache.app_models = old_app_models
- cache.app_store = old_app_store
@override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent')
def test_custom_swappable_manager(self):
@@ -140,7 +138,6 @@ class ManagersRegressionTests(TestCase):
# 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)
class SwappableModel(models.Model):
@@ -160,7 +157,6 @@ class ManagersRegressionTests(TestCase):
finally:
cache.app_models = old_app_models
- cache.app_store = old_app_store
@override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent')
def test_explicit_swappable_manager(self):
@@ -169,7 +165,6 @@ class ManagersRegressionTests(TestCase):
# 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)
class SwappableModel(models.Model):
@@ -189,7 +184,6 @@ class ManagersRegressionTests(TestCase):
finally:
cache.app_models = old_app_models
- cache.app_store = old_app_store
def test_regress_3871(self):
related = RelatedModel.objects.create()
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index fa8a212533..9d84d710bb 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -133,11 +133,9 @@ class MakeMigrationsTests(MigrationTestBase):
self.migration_dir = os.path.join(self.test_dir, 'migrations_%d' % self.creation_counter)
self.migration_pkg = "migrations.migrations_%d" % self.creation_counter
self._old_app_models = copy.deepcopy(cache.app_models)
- self._old_app_store = copy.deepcopy(cache.app_store)
def tearDown(self):
cache.app_models = self._old_app_models
- cache.app_store = self._old_app_store
cache._get_models_cache = {}
os.chdir(self.test_dir)
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index 11109c8186..cc32a7d751 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -2,7 +2,6 @@
from __future__ import unicode_literals
-import copy
import datetime
import os
@@ -116,8 +115,6 @@ class WriterTests(TestCase):
self.assertIn("Migration", result)
def test_migration_path(self):
- _old_app_store = copy.deepcopy(cache.app_store)
-
test_apps = [
'migrations.migrations_test_apps.normal',
'migrations.migrations_test_apps.with_package_model',
@@ -125,13 +122,10 @@ class WriterTests(TestCase):
base_dir = os.path.dirname(os.path.dirname(__file__))
- try:
- with override_settings(INSTALLED_APPS=test_apps):
- for app in test_apps:
- cache.load_app(app)
- migration = migrations.Migration('0001_initial', app.split('.')[-1])
- expected_path = os.path.join(base_dir, *(app.split('.') + ['migrations', '0001_initial.py']))
- writer = MigrationWriter(migration)
- self.assertEqual(writer.path, expected_path)
- finally:
- cache.app_store = _old_app_store
+ with override_settings(INSTALLED_APPS=test_apps):
+ for app in test_apps:
+ cache.load_app(app)
+ migration = migrations.Migration('0001_initial', app.split('.')[-1])
+ expected_path = os.path.join(base_dir, *(app.split('.') + ['migrations', '0001_initial.py']))
+ writer = MigrationWriter(migration)
+ self.assertEqual(writer.path, expected_path)
diff --git a/tests/proxy_model_inheritance/tests.py b/tests/proxy_model_inheritance/tests.py
index af22e7caed..0fad8c594f 100644
--- a/tests/proxy_model_inheritance/tests.py
+++ b/tests/proxy_model_inheritance/tests.py
@@ -32,8 +32,6 @@ class ProxyModelInheritanceTests(TransactionTestCase):
def tearDown(self):
sys.path = self.old_sys_path
- del cache.app_store[cache.app_labels['app1']]
- del cache.app_store[cache.app_labels['app2']]
del cache.app_labels['app1']
del cache.app_labels['app2']
del cache.app_models['app1']
diff --git a/tests/proxy_models/tests.py b/tests/proxy_models/tests.py
index a900366744..5b9433bbf7 100644
--- a/tests/proxy_models/tests.py
+++ b/tests/proxy_models/tests.py
@@ -160,7 +160,6 @@ class ProxyModelTests(TestCase):
# 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)
class SwappableModel(models.Model):
@@ -178,7 +177,6 @@ class ProxyModelTests(TestCase):
proxy = True
finally:
cache.app_models = old_app_models
- cache.app_store = old_app_store
def test_myperson_manager(self):
Person.objects.create(name="fred")
diff --git a/tests/tablespaces/tests.py b/tests/tablespaces/tests.py
index 0ee1b0e742..04240bcaa1 100644
--- a/tests/tablespaces/tests.py
+++ b/tests/tablespaces/tests.py
@@ -29,7 +29,6 @@ class TablespacesTests(TestCase):
# The unmanaged models need to be removed after the test in order to
# prevent bad interactions with the flush operation in other tests.
self.old_app_models = copy.deepcopy(cache.app_models)
- self.old_app_store = copy.deepcopy(cache.app_store)
for model in Article, Authors, Reviewers, Scientist:
model._meta.managed = True
@@ -39,7 +38,6 @@ class TablespacesTests(TestCase):
model._meta.managed = False
cache.app_models = self.old_app_models
- cache.app_store = self.old_app_store
cache._get_models_cache = {}
def assertNumContains(self, haystack, needle, count):