django/tests
Aymeric Augustin a4cb140004 Added get_app_config() to look up app configs by label.
Refactored get_app() to rely on that method.

get_app() starts by calling _populate(), which goes through
INSTALLED_APPS and, for each app, imports the app module and attempts to
import the models module. At this point, no further imports are
necessary to return the models module for a  given app. Therefore, the
implementation of get_app() can be simplified and the safeguards for
race conditions can be removed.

Besides, the emptyOK parameter isn't used anywhere in Django. It was
introduced in d6c95e93 but not actually used nor documented, and it has
just been carried around since then. Since it's an obscure private API,
it's acceptable to stop supporting it without a deprecation path. This
branch aims at providing first-class support for applications without a
models module eventually.

For backwards-compatibility, get_app() still raises ImproperlyConfigured
when an app isn't found, even though LookupError is technically more
correct. I haven't gone as far as to preserve the exact error messages.
I've adjusted a few tests instead.
2013-12-17 10:17:44 +01:00
..
admin_changelist PEP8 cleanup 2013-11-02 23:50:49 -05:00
admin_custom_urls PEP8 cleanup 2013-11-02 23:50:49 -05:00
admin_docs Fixed missing admindocs' site_header 2013-11-22 13:30:50 +01:00
admin_filters Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
admin_inlines PEP8 cleanup 2013-11-02 23:50:49 -05:00
admin_ordering Fixed some flake8 issues 2013-11-22 09:10:18 -08:00
admin_registration Fixed typo in exception message; refs #19414 2013-09-19 06:24:12 -04:00
admin_scripts Added get_app_config() to look up app configs by label. 2013-12-17 10:17:44 +01:00
admin_util PEP8 cleanup 2013-11-02 23:50:49 -05:00
admin_validation PEP8 cleanup 2013-11-02 23:50:49 -05:00
admin_views Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
admin_widgets Merging in master 2013-11-03 07:19:25 -06:00
aggregation PEP8 cleanup 2013-11-02 23:50:49 -05:00
aggregation_regress Fixed all E226 violations 2013-11-03 10:08:55 -08:00
app_cache Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
app_loading Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
backends PEP8 cleanup 2013-11-02 23:50:49 -05:00
base Fixed "redefinition of unused 'foo' from line X" pyflakes warnings. 2013-10-10 11:09:42 -04:00
bash_completion Whitespace cleanup. 2013-10-10 16:49:20 -04:00
basic PEP8 cleanup 2013-11-02 23:50:49 -05:00
bug639 PEP8 cleanup 2013-11-02 23:50:49 -05:00
bug8245 Removed most of absolute_import imports 2013-07-29 20:28:13 +02:00
builtin_server Stopped using django.utils.unittest in the test suite. 2013-07-01 14:29:33 +02:00
bulk_create Fixed all E226 violations 2013-11-03 10:08:55 -08:00
cache flake8 fixes 2013-11-24 21:07:21 -06:00
check PEP8 cleanup 2013-11-02 23:50:49 -05:00
choices PEP8 cleanup 2013-11-02 23:50:49 -05:00
commands_sql Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
comment_tests Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
conditional_processing PEP8 cleanup 2013-11-02 23:50:49 -05:00
contenttypes_tests Moved django.db.models.loading to django.apps.cache. 2013-12-17 10:17:43 +01:00
context_processors Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
createsuperuser Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
csrf_tests PEP8 cleanup 2013-11-02 23:50:49 -05:00
custom_columns Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
custom_columns_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
custom_managers PEP-8 cleanup 2013-11-27 19:45:47 +02:00
custom_managers_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
custom_methods Removed most of absolute_import imports 2013-07-29 20:28:13 +02:00
custom_pk Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
datatypes Fixed all E251 violations 2013-11-03 10:17:58 -08:00
dates PEP8 cleanup 2013-11-02 23:50:49 -05:00
datetimes Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning. 2013-11-14 21:36:55 +01:00
db_backends Fixed #13813 -- Comparison of DatabaseWrappers doesn't raise errors. 2013-07-08 09:35:08 +10:00
db_typecasts PEP8 cleanup 2013-11-02 23:50:49 -05:00
decorators Fixed #21351 -- Replaced memoize with Python's lru_cache. 2013-11-11 08:53:09 +01:00
defaultfilters Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
defer Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
defer_regress Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
delete PEP8 cleanup 2013-11-02 23:50:49 -05:00
delete_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
deprecation Fixed #21351 -- Replaced memoize with Python's lru_cache. 2013-11-11 08:53:09 +01:00
dispatch PEP8 cleanup 2013-11-02 23:50:49 -05:00
distinct_on_fields Fixed #20600 -- ordered distinct(*fields) in subqueries 2013-11-07 14:29:50 +02:00
empty Added get_app_config() to look up app configs by label. 2013-12-17 10:17:44 +01:00
expressions Fixed all E226 violations 2013-11-03 10:08:55 -08:00
expressions_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
extra_regress Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
field_deconstruction Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
field_defaults Removed most of absolute_import imports 2013-07-29 20:28:13 +02:00
field_subclassing PEP8 cleanup 2013-11-02 23:50:49 -05:00
file_storage PEP8 cleanup 2013-11-02 23:50:49 -05:00
file_uploads PEP8 cleanup 2013-11-02 23:50:49 -05:00
files Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
fixtures PEP8 cleanup 2013-11-02 23:50:49 -05:00
fixtures_model_package PEP8 cleanup 2013-11-02 23:50:49 -05:00
fixtures_regress Fixed #21551 -- Reenabled loading fixtures from subdirectory 2013-12-07 10:47:34 +01:00
force_insert_update Fixed all E251 violations 2013-11-03 10:17:58 -08:00
foreign_object Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject. 2013-12-06 20:20:16 +01:00
forms_tests Fixed #17413 -- Serialization of form errors along with all metadata. 2013-12-16 16:33:28 -05:00
generic_inline_admin PEP8 cleanup 2013-11-02 23:50:49 -05:00
generic_relations PEP8 cleanup 2013-11-02 23:50:49 -05:00
generic_relations_regress Fixed #21403: Corrected test code 2013-11-25 16:16:04 +02:00
generic_views Fixed #21564 -- Use local request object when possible in generic views. 2013-12-16 16:58:08 +01:00
get_earliest_or_latest Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
get_object_or_404 Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
get_or_create Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
get_or_create_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
handlers PEP8 cleanup 2013-11-02 23:50:49 -05:00
http_utils Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
httpwrappers Simplified iteration in HTTP response objects. 2013-11-23 17:03:43 +01:00
i18n Fixed #21473 -- Limited language preservation to logout 2013-12-12 10:24:43 +01:00
indexes Stopped using django.utils.unittest in the test suite. 2013-07-01 14:29:33 +02:00
initial_sql_regress Fixed all E251 violations 2013-11-03 10:17:58 -08:00
inline_formsets Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
inspectdb PEP8 cleanup 2013-11-02 23:50:49 -05:00
introspection Fixed #21097 - Added DatabaseFeature.can_introspect_autofield 2013-09-14 09:48:59 +03:00
invalid_models Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
known_related_objects PEP8 cleanup 2013-11-02 23:50:49 -05:00
logging_tests Fixed #21383 -- Added request details in SuspiciousOperation messages 2013-11-09 12:11:58 +01:00
lookup Fixed all E226 violations 2013-11-03 10:08:55 -08:00
m2m_and_m2o PEP8 cleanup 2013-11-02 23:50:49 -05:00
m2m_intermediary PEP8 cleanup 2013-11-02 23:50:49 -05:00
m2m_multiple Fixed "indentation is not a multiple of four" pep8 issues. 2013-09-03 14:22:21 -04:00
m2m_recursive Fix all violators of E231 2013-10-26 12:15:03 -07:00
m2m_regress Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
m2m_signals PEP8 cleanup 2013-11-02 23:50:49 -05:00
m2m_through PEP8 cleanup 2013-11-02 23:50:49 -05:00
m2m_through_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
m2o_recursive PEP8 cleanup 2013-11-02 23:50:49 -05:00
mail Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
managers_regress Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
many_to_many PEP8 cleanup 2013-11-02 23:50:49 -05:00
many_to_one Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
many_to_one_null PEP8 cleanup 2013-11-02 23:50:49 -05:00
many_to_one_regress PEP8 cleanup 2013-11-02 23:50:49 -05:00
max_lengths PEP8 cleanup 2013-11-02 23:50:49 -05:00
middleware PEP8 cleanup 2013-11-02 23:50:49 -05:00
middleware_exceptions Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
migrate_signals Updated syncdb -> migrate in tests. 2013-09-03 11:51:34 -04:00
migrations Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
model_fields Fixed #21512 -- Added more complete information about Pillow and PIL in model_fields and model_forms tests. 2013-11-26 10:18:54 +01:00
model_forms Fixed #21512 -- Added more complete information about Pillow and PIL in model_fields and model_forms tests. 2013-11-26 10:18:54 +01:00
model_forms_regress Fixed #21568 -- Added missing ModelMultipleChoiceField to_python method 2013-12-07 10:14:22 +01:00
model_formsets PEP8 2013-11-02 23:50:38 -05:00
model_formsets_regress PEP8 2013-11-02 23:50:38 -05:00
model_inheritance PEP8 2013-11-02 23:50:38 -05:00
model_inheritance_regress Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
model_inheritance_same_model_name PEP8 cleanup 2013-11-02 23:50:49 -05:00
model_inheritance_select_related PEP8 2013-11-02 23:50:38 -05:00
model_package Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
model_permalink Removed most of absolute_import imports 2013-07-29 20:28:13 +02:00
model_regress Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
model_validation Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
modeladmin Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
multiple_database PEP8 cleanup 2013-11-02 23:50:49 -05:00
mutually_referential Fixing E302 Errors 2013-11-02 23:48:47 -05:00
nested_foreign_keys Fixing E302 Errors 2013-11-02 23:48:47 -05:00
null_fk Fixed all E251 violations 2013-11-03 10:17:58 -08:00
null_fk_ordering Fixing E302 Errors 2013-11-02 23:48:47 -05:00
null_queries Fixing E302 Errors 2013-11-02 23:48:47 -05:00
one_to_one Fixed #21563 -- Single related object descriptors should work with `hasattr`. 2013-12-11 12:49:28 -05:00
one_to_one_regress Fixed #21216 -- Allow `OneToOneField` reverse accessor to be hidden. 2013-10-03 13:20:05 -04:00
or_lookups Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
order_with_respect_to Fixing E302 Errors 2013-11-02 23:48:47 -05:00
ordering Fixing E302 Errors 2013-11-02 23:48:47 -05:00
pagination Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
prefetch_related Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
properties Fixed the use of the -ise suffix, where -ize is prefered 2013-11-15 05:23:14 -08:00
proxy_model_inheritance Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
proxy_models Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
queries Fixed #11320 -- exclude() too aggressive in join promotion 2013-11-07 12:57:02 +02:00
queryset_pickle Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
raw_query Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
requests Fixed #21447 -- Restored code erroneously removed in 20472aa827. 2013-11-16 01:09:35 +01:00
requirements Fixed #21538 -- Added numpy to test/requirements/base.txt 2013-12-02 13:37:59 -05:00
reserved_names Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
resolve_url Whitespace cleanup. 2013-10-10 16:49:20 -04:00
responses Fixing E302 Errors 2013-11-02 23:48:47 -05:00
reverse_lookup Fixing E302 Errors 2013-11-02 23:48:47 -05:00
reverse_single_related Fixed #21563 -- Single related object descriptors should work with `hasattr`. 2013-12-11 12:49:28 -05:00
save_delete_hooks Removed most of absolute_import imports 2013-07-29 20:28:13 +02:00
schema Moved django.db.models.loading to django.apps.cache. 2013-12-17 10:17:43 +01:00
select_for_update Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
select_related Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
select_related_onetoone Fixing E302 Errors 2013-11-02 23:48:47 -05:00
select_related_regress Fixed all E251 violations 2013-11-03 10:17:58 -08:00
serializers Added missing deconstruct() methods. 2013-12-06 15:23:34 +01:00
serializers_regress Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
servers Fixing E302 Errors 2013-11-02 23:48:47 -05:00
settings_tests Fixing E302 Errors 2013-11-02 23:48:47 -05:00
signals Fixed #21391 -- Allow model signals to lazily reference their senders. 2013-11-24 17:51:22 -05:00
signed_cookies_tests Fixed all E251 violations 2013-11-03 10:17:58 -08:00
signing Fixing E302 Errors 2013-11-02 23:48:47 -05:00
sites_framework Fixed all E226 violations 2013-11-03 10:08:55 -08:00
staticfiles_tests Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
str Fixing E302 Errors 2013-11-02 23:48:47 -05:00
string_lookup Fixing E302 Errors 2013-11-02 23:48:47 -05:00
swappable_models Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
syndication Fixing E302 Errors 2013-11-02 23:48:47 -05:00
tablespaces Moved list of models inside AppConfig instances. 2013-12-17 10:17:44 +01:00
template_tests Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
templates Fixed #21460 -- Reenabled proper template precedence in find_template 2013-11-22 11:09:51 +01:00
test_client Fixed #21448 -- Fixed test client logout with cookie-based sessions 2013-11-26 20:41:51 +01:00
test_client_regress Fixed #15179 -- middlewares not applied for test client login() 2013-11-19 09:04:20 +02:00
test_discovery_sample Removed tests for django.utils.unittest vs. unittest. 2013-07-01 21:49:11 +02:00
test_discovery_sample2 Fixed #17365, #17366, #18727 -- Switched to discovery test runner. 2013-05-10 23:08:45 -04:00
test_runner Fixing E302 Errors 2013-11-02 23:48:47 -05:00
test_runner_deprecation_app Fixing E302 Errors 2013-11-02 23:48:47 -05:00
test_runner_invalid_app Fixed #17365, #17366, #18727 -- Switched to discovery test runner. 2013-05-10 23:08:45 -04:00
test_suite_override Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
test_utils Fixed #21462 -- Made `assertNumQueries` print executed queries on failure. 2013-12-11 15:24:17 -05:00
text Fixed #20231 -- Don't use allow_lazy on smart_split 2013-04-10 13:05:29 +02:00
timezones Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
transactions Fixing E302 Errors 2013-11-02 23:48:47 -05:00
transactions_regress Fixing E302 Errors 2013-11-02 23:48:47 -05:00
unmanaged_models Fixing E302 Errors 2013-11-02 23:48:47 -05:00
update Fixing E302 Errors 2013-11-02 23:48:47 -05:00
update_only_fields Fixing E302 Errors 2013-11-02 23:48:47 -05:00
urlpatterns_reverse Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
user_commands Fixing E302 Errors 2013-11-02 23:48:47 -05:00
utils_tests Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
validation Moved django.db.models.loading to django.apps.cache. 2013-12-17 10:17:43 +01:00
validators Fixing E302 Errors 2013-11-02 23:48:47 -05:00
version Fixing E302 Errors 2013-11-02 23:48:47 -05:00
view_tests Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
wsgi Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
.coveragerc Made coverage ignore files without associated source code. 2013-08-25 22:29:43 -03:00
runtests.py Removed module-level functions for the app cache. 2013-12-17 10:17:44 +01:00
test_sqlite.py Updated an inaccurate comment. 2013-02-26 10:00:14 +01:00
urls.py Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00