From 6e895f9e069f73982751cd2d4aa5aa693136a274 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Tue, 17 Dec 2013 10:27:08 +0100 Subject: [PATCH] Removed superfluous models.py files. Added comments in the three empty models.py files that are still needed. Adjusted the test runner to add applications corresponding to test labels to INSTALLED_APPS even when they don't have a models module. --- django/contrib/admindocs/models.py | 1 - django/contrib/formtools/models.py | 3 ++- django/contrib/humanize/models.py | 0 django/contrib/messages/models.py | 1 - django/contrib/sitemaps/models.py | 3 ++- django/contrib/staticfiles/models.py | 0 django/contrib/webdesign/models.py | 0 tests/admin_docs/models.py | 0 .../admin_scripts/custom_templates/app_template/models.py | 1 - tests/app_loading/models.py | 0 tests/bash_completion/models.py | 0 tests/builtin_server/models.py | 0 tests/conditional_processing/models.py | 0 tests/context_processors/models.py | 1 - tests/createsuperuser/models.py | 0 tests/csrf_tests/models.py | 1 - tests/db_typecasts/models.py | 0 tests/decorators/models.py | 1 - tests/defaultfilters/models.py | 0 tests/deprecation/models.py | 0 tests/dispatch/models.py | 0 tests/field_deconstruction/models.py | 0 tests/files/models.py | 0 tests/handlers/models.py | 0 tests/http_utils/models.py | 0 tests/httpwrappers/models.py | 0 tests/i18n/resolution/models.py | 1 - tests/invalid_models/models.py | 0 tests/logging_tests/models.py | 0 tests/middleware_exceptions/models.py | 0 tests/migrate_signals/models.py | 2 ++ tests/migrations/migrations_test_apps/normal/models.py | 0 tests/requests/models.py | 1 - tests/responses/models.py | 0 tests/runtests.py | 7 +++---- tests/servers/another_app/models.py | 0 tests/signed_cookies_tests/models.py | 1 - tests/signing/models.py | 1 - tests/staticfiles_tests/apps/no_label/models.py | 0 tests/staticfiles_tests/apps/test/models.py | 0 tests/staticfiles_tests/models.py | 0 tests/template_tests/models.py | 0 tests/test_client/models.py | 0 tests/test_runner_deprecation_app/models.py | 0 tests/test_suite_override/models.py | 0 tests/text/models.py | 0 tests/urlpatterns_reverse/models.py | 0 tests/validators/models.py | 0 tests/version/models.py | 0 tests/wsgi/models.py | 0 50 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 django/contrib/admindocs/models.py delete mode 100644 django/contrib/humanize/models.py delete mode 100644 django/contrib/messages/models.py delete mode 100644 django/contrib/staticfiles/models.py delete mode 100644 django/contrib/webdesign/models.py delete mode 100644 tests/admin_docs/models.py delete mode 100644 tests/admin_scripts/custom_templates/app_template/models.py delete mode 100644 tests/app_loading/models.py delete mode 100644 tests/bash_completion/models.py delete mode 100644 tests/builtin_server/models.py delete mode 100644 tests/conditional_processing/models.py delete mode 100644 tests/context_processors/models.py delete mode 100644 tests/createsuperuser/models.py delete mode 100644 tests/csrf_tests/models.py delete mode 100644 tests/db_typecasts/models.py delete mode 100644 tests/decorators/models.py delete mode 100644 tests/defaultfilters/models.py delete mode 100644 tests/deprecation/models.py delete mode 100644 tests/dispatch/models.py delete mode 100644 tests/field_deconstruction/models.py delete mode 100644 tests/files/models.py delete mode 100644 tests/handlers/models.py delete mode 100644 tests/http_utils/models.py delete mode 100644 tests/httpwrappers/models.py delete mode 100644 tests/i18n/resolution/models.py delete mode 100644 tests/invalid_models/models.py delete mode 100644 tests/logging_tests/models.py delete mode 100644 tests/middleware_exceptions/models.py delete mode 100644 tests/migrations/migrations_test_apps/normal/models.py delete mode 100644 tests/requests/models.py delete mode 100644 tests/responses/models.py delete mode 100644 tests/servers/another_app/models.py delete mode 100644 tests/signed_cookies_tests/models.py delete mode 100644 tests/signing/models.py delete mode 100644 tests/staticfiles_tests/apps/no_label/models.py delete mode 100644 tests/staticfiles_tests/apps/test/models.py delete mode 100644 tests/staticfiles_tests/models.py delete mode 100644 tests/template_tests/models.py delete mode 100644 tests/test_client/models.py delete mode 100644 tests/test_runner_deprecation_app/models.py delete mode 100644 tests/test_suite_override/models.py delete mode 100644 tests/text/models.py delete mode 100644 tests/urlpatterns_reverse/models.py delete mode 100644 tests/validators/models.py delete mode 100644 tests/version/models.py delete mode 100644 tests/wsgi/models.py diff --git a/django/contrib/admindocs/models.py b/django/contrib/admindocs/models.py deleted file mode 100644 index a9f813a4cb..0000000000 --- a/django/contrib/admindocs/models.py +++ /dev/null @@ -1 +0,0 @@ -# Empty models.py to allow for specifying admindocs as a test label. diff --git a/django/contrib/formtools/models.py b/django/contrib/formtools/models.py index 13990e24af..8a90059b9d 100644 --- a/django/contrib/formtools/models.py +++ b/django/contrib/formtools/models.py @@ -1 +1,2 @@ -""" models.py (even empty) currently required by the runtests.py to enable unit tests """ +# This file is required to pretend formtools has models. +# Otherwise test models cannot be registered. diff --git a/django/contrib/humanize/models.py b/django/contrib/humanize/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/django/contrib/messages/models.py b/django/contrib/messages/models.py deleted file mode 100644 index 4f656f5082..0000000000 --- a/django/contrib/messages/models.py +++ /dev/null @@ -1 +0,0 @@ -# Models module required so tests are discovered. diff --git a/django/contrib/sitemaps/models.py b/django/contrib/sitemaps/models.py index 6e7633bfe0..9ade3254cc 100644 --- a/django/contrib/sitemaps/models.py +++ b/django/contrib/sitemaps/models.py @@ -1 +1,2 @@ -# This file intentionally left blank +# This file is required to pretend sitemaps has models. +# Otherwise test models cannot be registered. diff --git a/django/contrib/staticfiles/models.py b/django/contrib/staticfiles/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/django/contrib/webdesign/models.py b/django/contrib/webdesign/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/admin_docs/models.py b/tests/admin_docs/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/admin_scripts/custom_templates/app_template/models.py b/tests/admin_scripts/custom_templates/app_template/models.py deleted file mode 100644 index fcd0b215d8..0000000000 --- a/tests/admin_scripts/custom_templates/app_template/models.py +++ /dev/null @@ -1 +0,0 @@ -# whatever diff --git a/tests/app_loading/models.py b/tests/app_loading/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/bash_completion/models.py b/tests/bash_completion/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/builtin_server/models.py b/tests/builtin_server/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/conditional_processing/models.py b/tests/conditional_processing/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/context_processors/models.py b/tests/context_processors/models.py deleted file mode 100644 index cde172db68..0000000000 --- a/tests/context_processors/models.py +++ /dev/null @@ -1 +0,0 @@ -# Models file for tests to run. diff --git a/tests/createsuperuser/models.py b/tests/createsuperuser/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/csrf_tests/models.py b/tests/csrf_tests/models.py deleted file mode 100644 index 71abcc5198..0000000000 --- a/tests/csrf_tests/models.py +++ /dev/null @@ -1 +0,0 @@ -# models.py file for tests to run. diff --git a/tests/db_typecasts/models.py b/tests/db_typecasts/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/decorators/models.py b/tests/decorators/models.py deleted file mode 100644 index 22e41b9828..0000000000 --- a/tests/decorators/models.py +++ /dev/null @@ -1 +0,0 @@ -# A models.py so that tests run. diff --git a/tests/defaultfilters/models.py b/tests/defaultfilters/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/deprecation/models.py b/tests/deprecation/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/dispatch/models.py b/tests/dispatch/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/field_deconstruction/models.py b/tests/field_deconstruction/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/files/models.py b/tests/files/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/handlers/models.py b/tests/handlers/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/http_utils/models.py b/tests/http_utils/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/httpwrappers/models.py b/tests/httpwrappers/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/i18n/resolution/models.py b/tests/i18n/resolution/models.py deleted file mode 100644 index 792d600548..0000000000 --- a/tests/i18n/resolution/models.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/tests/invalid_models/models.py b/tests/invalid_models/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/logging_tests/models.py b/tests/logging_tests/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/middleware_exceptions/models.py b/tests/middleware_exceptions/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/migrate_signals/models.py b/tests/migrate_signals/models.py index e69de29bb2..55a8657a3c 100644 --- a/tests/migrate_signals/models.py +++ b/tests/migrate_signals/models.py @@ -0,0 +1,2 @@ +# Remove this module when pre/post_migrate are refactored to use something +# other than a models module for their "sender" argument. diff --git a/tests/migrations/migrations_test_apps/normal/models.py b/tests/migrations/migrations_test_apps/normal/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/requests/models.py b/tests/requests/models.py deleted file mode 100644 index 19f81d601a..0000000000 --- a/tests/requests/models.py +++ /dev/null @@ -1 +0,0 @@ -# Need a models module for the test runner. diff --git a/tests/responses/models.py b/tests/responses/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/runtests.py b/tests/runtests.py index d5b94064d5..badbd6fbec 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -164,10 +164,9 @@ def setup(verbosity, test_labels): if module_found_in_labels: if verbosity >= 2: print("Importing application %s" % module_name) - mod = app_cache.load_app(module_label) - if mod: - if module_label not in settings.INSTALLED_APPS: - settings.INSTALLED_APPS.append(module_label) + app_cache.load_app(module_label) + if module_label not in settings.INSTALLED_APPS: + settings.INSTALLED_APPS.append(module_label) return state diff --git a/tests/servers/another_app/models.py b/tests/servers/another_app/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/signed_cookies_tests/models.py b/tests/signed_cookies_tests/models.py deleted file mode 100644 index 71abcc5198..0000000000 --- a/tests/signed_cookies_tests/models.py +++ /dev/null @@ -1 +0,0 @@ -# models.py file for tests to run. diff --git a/tests/signing/models.py b/tests/signing/models.py deleted file mode 100644 index 71abcc5198..0000000000 --- a/tests/signing/models.py +++ /dev/null @@ -1 +0,0 @@ -# models.py file for tests to run. diff --git a/tests/staticfiles_tests/apps/no_label/models.py b/tests/staticfiles_tests/apps/no_label/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/staticfiles_tests/apps/test/models.py b/tests/staticfiles_tests/apps/test/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/staticfiles_tests/models.py b/tests/staticfiles_tests/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/template_tests/models.py b/tests/template_tests/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/test_client/models.py b/tests/test_client/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/test_runner_deprecation_app/models.py b/tests/test_runner_deprecation_app/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/test_suite_override/models.py b/tests/test_suite_override/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/text/models.py b/tests/text/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/urlpatterns_reverse/models.py b/tests/urlpatterns_reverse/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/validators/models.py b/tests/validators/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/version/models.py b/tests/version/models.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/wsgi/models.py b/tests/wsgi/models.py deleted file mode 100644 index e69de29bb2..0000000000