1
0
mirror of https://github.com/django/django.git synced 2024-12-30 21:16:26 +00:00
django/tests
Simon Charette fead2dd523 [5.0.x] Fixed #35336 -- Addressed crash when adding a GeneratedField with % literals.
A longer term solution is likely to have a better separation of parametrized
DDL altogether to handle checks, constraints, defaults, and generated fields
but such a change would require a significant refactor that isn't suitable
for a backport.

Thanks Adrian Garcia for the report.

Backport of 888b9042b3 from main
2024-04-02 17:34:38 -03:00
..
absolute_url_overrides
admin_autodiscover
admin_changelist [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
admin_checks Fixed #9602 -- Added AdminSite.get_model_admin(). 2023-07-07 08:06:01 +02:00
admin_custom_urls
admin_default_site
admin_docs Fixed typo in tests/admin_docs/models.py. 2023-07-03 10:47:41 +02:00
admin_filters [5.0.x] Fixed #35198 -- Fixed facet filters crash on querysets with no primary key. 2024-02-29 10:37:26 +01:00
admin_inlines [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
admin_ordering Fixed #9602 -- Added AdminSite.get_model_admin(). 2023-07-07 08:06:01 +02:00
admin_registration Refs #9602 -- Moved AlreadyRegistered/NotRegistered exceptions to django.contrib.admin.exceptions. 2023-07-07 13:22:06 +02:00
admin_scripts [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
admin_utils Removed unnecessary trailing commas in tests. 2023-08-22 12:42:57 +02:00
admin_views [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
admin_widgets [5.0.x] Fixed #35273 -- Fixed rendering AdminFileWidget's attributes. 2024-03-14 20:37:53 +01:00
aggregation [5.0.x] Fixed #34975 -- Fixed crash of conditional aggregate() over aggregations. 2023-11-18 16:52:54 +01:00
aggregation_regress [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
annotations Fixed #34437 -- Made values() resolving error mention selected annotations. 2023-03-25 20:22:45 +01:00
app_loading
apps [5.0.x] Fixed #34849 -- Avoided raising RuntimeWarning about import-time queries when apps are reinitialized with test tools. 2023-09-25 09:14:05 +02:00
asgi [5.0.x] Fixed #35059 -- Ensured that ASGIHandler always sends the request_finished signal. 2024-01-31 14:45:44 -03:00
async Fixed #34331 -- Added QuerySet.aiterator() support for prefetch_related(). 2023-07-31 21:17:36 +02:00
auth_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
backends [5.0.x] Fixed #35238 -- Fixed database serialization crash when base managers use prefetch_related(). 2024-02-21 05:17:36 +01:00
base
bash_completion [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
basic [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
builtin_server Fixed #33865 -- Optimized LimitedStream wrapper. 2023-01-05 19:26:56 +01:00
bulk_create Fixed #34698 -- Made QuerySet.bulk_create() retrieve primary keys when updating conflicts. 2023-07-10 13:17:28 +02:00
cache Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
check_framework [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
conditional_processing Updated documentation and comments for RFC updates. 2022-11-10 13:52:17 +01:00
constraints [5.0.x] Refs #34840 -- Fixed test_validate_nullable_textfield_with_isnull_true() on databases that don's support table check constraints. 2023-10-12 20:02:02 +02:00
contenttypes_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
context_processors [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
csrf_tests Corrected logger in CsrfViewMiddlewareTestMixin.test_ensures_csrf_cookie_no_logging(). 2023-09-13 13:49:01 +02:00
custom_columns Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
custom_lookups [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
custom_managers Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
custom_methods Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
custom_migration_operations
custom_pk Removed unnecessary trailing commas in tests. 2023-08-22 12:42:57 +02:00
datatypes
dates Replaced assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. 2022-10-07 13:05:35 +02:00
datetimes Refs #32365 -- Removed support for pytz timezones per deprecation timeline. 2023-01-17 11:49:15 +01:00
db_functions [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
db_typecasts
db_utils [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
dbshell [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
decorators Refs #31949 -- Made make_middleware_decorator to work with async functions. 2023-09-13 11:41:01 +02:00
defer Fixed #34458 -- Fixed QuerySet.defer() crash on attribute names. 2023-04-05 05:38:10 +02:00
defer_regress Fixed #34612 -- Fixed QuerySet.only() crash on reverse relationships. 2023-06-01 19:50:47 +01:00
delete Fixed random delete.tests.DeletionTests.test_deletion_order failures. 2022-12-30 12:22:30 +01:00
delete_regress Refs #32433 -- Reallowed calling QuerySet.delete() after distinct(). 2023-07-07 07:08:28 +02:00
deprecation Fixed #34821 -- Prevented DEFAULT_FILE_STORAGE/STATICFILES_STORAGE settings from mutating the main STORAGES. 2023-09-11 13:04:32 +02:00
dispatch
distinct_on_fields [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
empty
empty_models
expressions [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
expressions_case Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
expressions_window [5.0.x] Fixed #34987 -- Fixed queryset crash when mixing aggregate and window annotations. 2023-11-23 06:09:58 +01:00
extra_regress Fixed #30382 -- Allowed specifying parent classes in force_insert of Model.save(). 2023-06-29 21:52:52 +02:00
field_deconstruction Fixed #31262 -- Added support for mappings on model fields and ChoiceField's choices. 2023-08-30 22:57:40 -03:00
field_defaults [5.0.x] Fixed #35223 -- Made Model.full_clean() ignore fields with db_default when validating empty values. 2024-03-08 06:46:40 +01:00
field_subclassing
file_storage Removed unnecessary trailing commas in tests. 2023-08-22 12:42:57 +02:00
file_uploads [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
files [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
filtered_relation [5.0.x] Fixed #35135 -- Made FilteredRelation raise ValueError on querysets as rhs. 2024-01-30 05:54:39 +01:00
fixtures [5.0.x] Fixed #35159 -- Fixed dumpdata crash when base querysets use prefetch_related(). 2024-01-31 16:10:50 +01:00
fixtures_model_package Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
fixtures_regress Fixed some typos in comments, docstrings, and tests. 2023-03-20 08:07:23 +01:00
flatpages_tests
force_insert_update [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
foreign_object Refs #16055 -- Deprecated get_joining_columns()/get_reverse_joining_columns() methods. 2023-04-18 12:46:27 +02:00
forms_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
from_db_value
generic_inline_admin Removed unnecessary trailing commas in tests. 2023-08-22 12:42:57 +02:00
generic_relations Fixed #33651 -- Added support for prefetching GenericForeignKey. 2023-09-18 13:23:21 +02:00
generic_relations_regress Fixed #34816 -- Fixed GenericForeignKey crash when checking cache for primary keys with different types. 2023-09-08 08:47:11 +02:00
generic_views Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
get_earliest_or_latest
get_object_or_404
get_or_create Fixed #34280 -- Allowed specifying different field values for create operation in QuerySet.update_or_create(). 2023-02-14 11:50:35 +01:00
gis_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
handlers [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
httpwrappers [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
humanize_tests [5.0.x] Fixed #35172 -- Fixed intcomma for string floats. 2024-02-08 10:59:43 +01:00
i18n [5.0.x] Fixed #34848 -- Ignored i18n_catalog.js file when building Django's translations catalog. 2023-09-22 08:55:11 +02:00
import_error_package
indexes Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
inline_formsets
inspectdb Fixed #33143 -- Raised RuntimeWarning when performing import-time queries. 2023-08-21 13:44:25 +02:00
introspection Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
invalid_models_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
known_related_objects Fixed #34227 -- Fixed QuerySet.select_related() with multi-level FilteredRelation. 2023-01-24 10:20:27 +01:00
logging_tests Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests. 2023-01-04 09:11:36 +01:00
lookup [5.0.x] Fixed #35018 -- Fixed migrations crash on GeneratedField with BooleanField as output_field on Oracle < 23c. 2023-12-12 05:41:38 +01:00
m2m_and_m2o [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
m2m_intermediary [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
m2m_multiple Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
m2m_recursive
m2m_regress Fixed #33984 -- Reverted "Fixed #32980 -- Made models cache related managers." 2022-09-30 18:18:33 +02:00
m2m_signals
m2m_through Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
m2m_through_regress
m2o_recursive
mail [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
managers_regress
many_to_many [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
many_to_one [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
many_to_one_null
max_lengths
messages_tests [5.0.x] Fixed #34958 -- Fixed isolation of messages_tests.tests.TestLevelTags.test_lazy. 2023-11-13 09:38:00 +01:00
middleware [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
middleware_exceptions Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
migrate_signals Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
migration_test_data_persistence Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
migrations [5.0.x] Fixed #35149 -- Fixed crashes of db_default with unresolvable output field. 2024-02-04 14:48:44 +01:00
migrations2 Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
model_enums Modernized enumeration helpers on Python 3.11+. 2023-09-13 08:30:21 +02:00
model_fields [5.0.x] Fixed #35344, Refs #34838 -- Corrected output_field of resolved columns for GeneratedFields in aliased tables. 2024-04-01 22:14:52 -03:00
model_forms [5.0.x] Refs #34380 -- Added FORMS_URLFIELD_ASSUME_HTTPS transitional setting. 2023-11-28 20:08:10 +01:00
model_formsets Fixed #34532 -- Made formset_factory() respect Form's default_renderer. 2023-07-24 09:09:53 +02:00
model_formsets_regress Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
model_indexes
model_inheritance [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
model_inheritance_regress [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
model_meta Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
model_options Refs #27236 -- Reverted AlterIndexTogether deprecation. 2022-07-26 11:41:19 +02:00
model_package
model_regress Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
model_utils
modeladmin [5.0.x] Fixed #35173 -- Fixed ModelAdmin.lookup_allowed() for lookups on foreign keys when not included in ModelAdmin.list_filter. 2024-02-15 08:18:27 -03:00
multiple_database Fixed #33985 -- Used app_config.verbose_name in ContentType.__str__(). 2023-03-09 10:27:08 +01:00
mutually_referential
nested_foreign_keys
no_models
null_fk Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
null_fk_ordering [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
null_queries
one_to_one [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
or_lookups Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual(). 2022-10-08 08:07:38 +02:00
order_with_respect_to [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
ordering Fixed #34372 -- Fixed queryset crash on order by aggregation using OrderBy. 2023-02-27 07:10:19 +01:00
pagination Improved style of n-tuple wording in docs and comments. 2023-06-23 09:29:35 +02:00
postgres_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
prefetch_related [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
project_template
properties
proxy_model_inheritance
proxy_models [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
queries [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
queryset_pickle
raw_query
redirects_tests
requests_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
requirements Refs #34233 -- Bumped minimum supported version of docutils to 0.19. 2023-09-04 22:30:45 +02:00
reserved_names
resolve_url
responses Added tests for HttpResponseBase.charset/reason_phrase setters. 2023-06-10 20:43:05 +02:00
reverse_lookup
save_delete_hooks [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
schema [5.0.x] Fixed #35336 -- Addressed crash when adding a GeneratedField with % literals. 2024-04-02 17:34:38 -03:00
select_for_update Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
select_related
select_related_onetoone Fixed #34612 -- Fixed QuerySet.only() crash on reverse relationships. 2023-06-01 19:50:47 +01:00
select_related_regress
serializers [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
servers [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
sessions_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
settings_tests Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
shell
shortcuts
signals [5.0.x] Fixed #35174 -- Fixed Signal.asend()/asend_robust() crash when all receivers are asynchronous. 2024-02-08 12:56:41 +01:00
signed_cookies_tests
signing Fixed #33199 -- Deprecated passing positional arguments to Signer/TimestampSigner. 2022-12-09 12:44:48 +01:00
sitemaps_tests Fixed #34688 -- Removed contrib.sitemaps.ping_google() and ping_google management command. 2023-07-10 05:59:35 +02:00
sites_framework Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
sites_tests
staticfiles_tests Refs #34712 -- Added system check for staticfiles storage in STORAGES setting. 2023-08-31 08:21:44 +02:00
str
string_lookup
swappable_models Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
syndication_tests
template_backends Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
template_loader
template_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
templates
test_client [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
test_client_regress [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
test_exceptions
test_runner [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
test_runner_apps
test_utils [5.0.x] Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.2+. 2024-02-10 17:08:07 +01:00
timezones [5.0.x] Fixed #34921 -- Fixed crash of warning for unbound naive datetimes. 2023-10-22 19:34:13 +02:00
transaction_hooks Fixed #33616 -- Allowed registering callbacks that can fail in transaction.on_commit(). 2022-09-06 12:21:36 +02:00
transactions [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
unmanaged_models Refs #33476 -- Applied Black's 2023 stable style. 2023-02-01 11:04:38 +01:00
update Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by annotations. 2023-03-18 13:19:40 +01:00
update_only_fields
urlpatterns
urlpatterns_reverse [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
user_commands Simplified call_command() calls. 2023-07-27 15:48:47 +02:00
utils_tests [5.0.x] Fixed CVE-2024-27351 -- Prevented potential ReDoS in Truncator.words(). 2024-03-04 08:22:40 +01:00
validation Fixed #34701 -- Added support for NULLS [NOT] DISTINCT on PostgreSQL 15+. 2023-07-19 21:42:27 +02:00
validators Removed unneeded escapes in regexes. 2023-08-02 19:53:16 +02:00
version
view_tests [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00
wsgi
xor_lookups Fixed #34604 -- Corrected fallback SQL for n-ary logical XOR. 2023-06-08 20:41:18 +02:00
.coveragerc Fixed #34810 -- Measured test coverage on django-admin commands. 2023-09-07 15:47:26 -03:00
README.rst
runtests.py Fixed #34810 -- Measured test coverage on django-admin commands. 2023-09-07 15:47:26 -03:00
sitecustomize.py Fixed #34810 -- Measured test coverage on django-admin commands. 2023-09-07 15:47:26 -03:00
test_sqlite.py
urls.py [5.0.x] Applied Black's 2024 stable style. 2024-01-26 12:55:56 +01:00

To run the test suite, first, create and activate a virtual environment. Then
install some requirements and run the tests::

    $ cd tests
    $ python -m pip install -e ..
    $ python -m pip install -r requirements/py3.txt
    $ ./runtests.py

For more information about the test suite, see
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/.