diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 512ea1424d..c26f34bad2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.1.0 hooks: - id: black exclude: \.py-tpl$ diff --git a/django/contrib/admin/migrations/0001_initial.py b/django/contrib/admin/migrations/0001_initial.py index d02e128497..6270e1032d 100644 --- a/django/contrib/admin/migrations/0001_initial.py +++ b/django/contrib/admin/migrations/0001_initial.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("contenttypes", "__first__"), diff --git a/django/contrib/admin/migrations/0002_logentry_remove_auto_add.py b/django/contrib/admin/migrations/0002_logentry_remove_auto_add.py index 4e83978e21..7fcf9c0c39 100644 --- a/django/contrib/admin/migrations/0002_logentry_remove_auto_add.py +++ b/django/contrib/admin/migrations/0002_logentry_remove_auto_add.py @@ -3,7 +3,6 @@ from django.utils import timezone class Migration(migrations.Migration): - dependencies = [ ("admin", "0001_initial"), ] diff --git a/django/contrib/admin/migrations/0003_logentry_add_action_flag_choices.py b/django/contrib/admin/migrations/0003_logentry_add_action_flag_choices.py index 59b22314d4..a73e55fc25 100644 --- a/django/contrib/admin/migrations/0003_logentry_add_action_flag_choices.py +++ b/django/contrib/admin/migrations/0003_logentry_add_action_flag_choices.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("admin", "0002_logentry_remove_auto_add"), ] diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 4f24cc4ce1..84af9f5dac 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -980,7 +980,7 @@ class ModelAdmin(BaseModelAdmin): base_action_names = {name for _, name, _ in base_actions} # Gather actions from the admin site first - for (name, func) in self.admin_site.actions: + for name, func in self.admin_site.actions: if name in base_action_names: continue description = self._get_action_description(func, name) @@ -1104,6 +1104,7 @@ class ModelAdmin(BaseModelAdmin): Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates. """ + # Apply keyword searches. def construct_search(field_name): if field_name.startswith("^"): diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index 70c3949fef..dc857055b1 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -17,7 +17,6 @@ class CSPMiddleware(MiddlewareMixin): @modify_settings(MIDDLEWARE={"append": "django.contrib.admin.tests.CSPMiddleware"}) class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): - available_apps = [ "django.contrib.admin", "django.contrib.auth", diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py index 1d08541057..a5e710835e 100644 --- a/django/contrib/admindocs/views.py +++ b/django/contrib/admindocs/views.py @@ -148,7 +148,7 @@ class ViewIndexView(BaseAdminDocsView): view_functions = extract_views_from_urlpatterns(url_resolver.url_patterns) except ImproperlyConfigured: view_functions = [] - for (func, regex, namespace, name) in view_functions: + for func, regex, namespace, name in view_functions: views.append( { "full_name": get_view_name(func), diff --git a/django/contrib/auth/migrations/0001_initial.py b/django/contrib/auth/migrations/0001_initial.py index 3d1635f461..cfeaa3aeae 100644 --- a/django/contrib/auth/migrations/0001_initial.py +++ b/django/contrib/auth/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.utils import timezone class Migration(migrations.Migration): - dependencies = [ ("contenttypes", "__first__"), ] diff --git a/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py b/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py index a9ca6f51a9..67a9560aa8 100644 --- a/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py +++ b/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0001_initial"), ] diff --git a/django/contrib/auth/migrations/0003_alter_user_email_max_length.py b/django/contrib/auth/migrations/0003_alter_user_email_max_length.py index 8a57548460..13d437e72e 100644 --- a/django/contrib/auth/migrations/0003_alter_user_email_max_length.py +++ b/django/contrib/auth/migrations/0003_alter_user_email_max_length.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0002_alter_permission_name_max_length"), ] diff --git a/django/contrib/auth/migrations/0004_alter_user_username_opts.py b/django/contrib/auth/migrations/0004_alter_user_username_opts.py index 6930e9bccb..f3fe36adcb 100644 --- a/django/contrib/auth/migrations/0004_alter_user_username_opts.py +++ b/django/contrib/auth/migrations/0004_alter_user_username_opts.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0003_alter_user_email_max_length"), ] diff --git a/django/contrib/auth/migrations/0005_alter_user_last_login_null.py b/django/contrib/auth/migrations/0005_alter_user_last_login_null.py index 8407e2d822..42b584e9f5 100644 --- a/django/contrib/auth/migrations/0005_alter_user_last_login_null.py +++ b/django/contrib/auth/migrations/0005_alter_user_last_login_null.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0004_alter_user_username_opts"), ] diff --git a/django/contrib/auth/migrations/0006_require_contenttypes_0002.py b/django/contrib/auth/migrations/0006_require_contenttypes_0002.py index b4e816a56f..2032c112a0 100644 --- a/django/contrib/auth/migrations/0006_require_contenttypes_0002.py +++ b/django/contrib/auth/migrations/0006_require_contenttypes_0002.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("auth", "0005_alter_user_last_login_null"), ("contenttypes", "0002_remove_content_type_name"), diff --git a/django/contrib/auth/migrations/0007_alter_validators_add_error_messages.py b/django/contrib/auth/migrations/0007_alter_validators_add_error_messages.py index 3c94141e61..ca010807c8 100644 --- a/django/contrib/auth/migrations/0007_alter_validators_add_error_messages.py +++ b/django/contrib/auth/migrations/0007_alter_validators_add_error_messages.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0006_require_contenttypes_0002"), ] diff --git a/django/contrib/auth/migrations/0008_alter_user_username_max_length.py b/django/contrib/auth/migrations/0008_alter_user_username_max_length.py index bfb844bb2a..caac0f1d69 100644 --- a/django/contrib/auth/migrations/0008_alter_user_username_max_length.py +++ b/django/contrib/auth/migrations/0008_alter_user_username_max_length.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0007_alter_validators_add_error_messages"), ] diff --git a/django/contrib/auth/migrations/0009_alter_user_last_name_max_length.py b/django/contrib/auth/migrations/0009_alter_user_last_name_max_length.py index e0665366d0..d347829064 100644 --- a/django/contrib/auth/migrations/0009_alter_user_last_name_max_length.py +++ b/django/contrib/auth/migrations/0009_alter_user_last_name_max_length.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0008_alter_user_username_max_length"), ] diff --git a/django/contrib/auth/migrations/0010_alter_group_name_max_length.py b/django/contrib/auth/migrations/0010_alter_group_name_max_length.py index a58e11480f..8ba274477f 100644 --- a/django/contrib/auth/migrations/0010_alter_group_name_max_length.py +++ b/django/contrib/auth/migrations/0010_alter_group_name_max_length.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0009_alter_user_last_name_max_length"), ] diff --git a/django/contrib/auth/migrations/0012_alter_user_first_name_max_length.py b/django/contrib/auth/migrations/0012_alter_user_first_name_max_length.py index 839c950417..1014f20498 100644 --- a/django/contrib/auth/migrations/0012_alter_user_first_name_max_length.py +++ b/django/contrib/auth/migrations/0012_alter_user_first_name_max_length.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "0011_update_proxy_permissions"), ] diff --git a/django/contrib/contenttypes/migrations/0001_initial.py b/django/contrib/contenttypes/migrations/0001_initial.py index 5468fb6a0d..7ea39d4f3f 100644 --- a/django/contrib/contenttypes/migrations/0001_initial.py +++ b/django/contrib/contenttypes/migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py b/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py index cb026e7503..29f047434b 100644 --- a/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py +++ b/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py @@ -13,7 +13,6 @@ def add_legacy_name(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("contenttypes", "0001_initial"), ] diff --git a/django/contrib/flatpages/migrations/0001_initial.py b/django/contrib/flatpages/migrations/0001_initial.py index 631ebbcb1e..db95098841 100644 --- a/django/contrib/flatpages/migrations/0001_initial.py +++ b/django/contrib/flatpages/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("sites", "0001_initial"), ] diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py index 9ba262aaf8..2a5c135d5c 100644 --- a/django/contrib/gis/admin/widgets.py +++ b/django/contrib/gis/admin/widgets.py @@ -97,6 +97,7 @@ class OpenLayersWidget(Textarea): def map_options(self): """Build the map options hash for the OpenLayers template.""" + # JavaScript construction utilities for the Bounds and Projection. def ol_bounds(extent): return "new OpenLayers.Bounds(%s)" % extent diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index ba7e3ca4d8..9a8816aeac 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -54,7 +54,6 @@ class SDORelate(SpatialOperator): class OracleOperations(BaseSpatialOperations, DatabaseOperations): - name = "oracle" oracle = True disallowed_aggregates = (models.Collect, models.Extent3D, models.MakeLine) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index bafb99a058..c004b11e50 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -20,7 +20,6 @@ from django.utils.encoding import force_bytes, force_str class GEOSGeometryBase(GEOSBase): - _GEOS_CLASSES = None ptr_type = GEOM_PTR diff --git a/django/contrib/redirects/migrations/0001_initial.py b/django/contrib/redirects/migrations/0001_initial.py index 3b3b87962a..7881d5798c 100644 --- a/django/contrib/redirects/migrations/0001_initial.py +++ b/django/contrib/redirects/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("sites", "0001_initial"), ] diff --git a/django/contrib/redirects/migrations/0002_alter_redirect_new_path_help_text.py b/django/contrib/redirects/migrations/0002_alter_redirect_new_path_help_text.py index 84f67e10d9..9976366005 100644 --- a/django/contrib/redirects/migrations/0002_alter_redirect_new_path_help_text.py +++ b/django/contrib/redirects/migrations/0002_alter_redirect_new_path_help_text.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("redirects", "0001_initial"), ] diff --git a/django/contrib/sessions/migrations/0001_initial.py b/django/contrib/sessions/migrations/0001_initial.py index 83b0bbc2ae..42e382aa32 100644 --- a/django/contrib/sessions/migrations/0001_initial.py +++ b/django/contrib/sessions/migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/django/contrib/sitemaps/views.py b/django/contrib/sitemaps/views.py index 679f7ed611..1f5b5ef314 100644 --- a/django/contrib/sitemaps/views.py +++ b/django/contrib/sitemaps/views.py @@ -58,7 +58,6 @@ def index( content_type="application/xml", sitemap_url_name="django.contrib.sitemaps.views.sitemap", ): - req_protocol = request.scheme req_site = get_current_site(request) @@ -108,7 +107,6 @@ def sitemap( template_name="sitemap.xml", content_type="application/xml", ): - req_protocol = request.scheme req_site = get_current_site(request) diff --git a/django/contrib/sites/migrations/0001_initial.py b/django/contrib/sites/migrations/0001_initial.py index 181cf47ad7..a23f0f129b 100644 --- a/django/contrib/sites/migrations/0001_initial.py +++ b/django/contrib/sites/migrations/0001_initial.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/django/contrib/sites/migrations/0002_alter_domain_unique.py b/django/contrib/sites/migrations/0002_alter_domain_unique.py index ccc7bfc384..e379a91f67 100644 --- a/django/contrib/sites/migrations/0002_alter_domain_unique.py +++ b/django/contrib/sites/migrations/0002_alter_domain_unique.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("sites", "0001_initial"), ] diff --git a/django/contrib/sites/models.py b/django/contrib/sites/models.py index e1544f1fa2..7f8bce920e 100644 --- a/django/contrib/sites/models.py +++ b/django/contrib/sites/models.py @@ -77,7 +77,6 @@ class SiteManager(models.Manager): class Site(models.Model): - domain = models.CharField( _("domain name"), max_length=100, diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py index e022b96abe..f41105177f 100644 --- a/django/core/cache/backends/db.py +++ b/django/core/cache/backends/db.py @@ -40,7 +40,6 @@ class BaseDatabaseCache(BaseCache): class DatabaseCache(BaseDatabaseCache): - # This class uses cursors provided by the database connection. This means # it reads expiration values as aware or naive datetimes, depending on the # value of USE_TZ and whether the database supports time zones. The ORM's diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index 038b82698d..cc183517e3 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -193,7 +193,7 @@ class Command(BaseCommand): # There is no need to sort dependencies when natural foreign # keys are not used. models = [] - for (app_config, model_list) in app_list.items(): + for app_config, model_list in app_list.items(): if model_list is None: models.extend(app_config.get_models()) else: diff --git a/django/core/management/commands/squashmigrations.py b/django/core/management/commands/squashmigrations.py index a46edb3b7b..6571cbc2e2 100644 --- a/django/core/management/commands/squashmigrations.py +++ b/django/core/management/commands/squashmigrations.py @@ -60,7 +60,6 @@ class Command(BaseCommand): ) def handle(self, **options): - self.verbosity = options["verbosity"] self.interactive = options["interactive"] app_label = options["app_label"] diff --git a/django/core/management/templates.py b/django/core/management/templates.py index 433150e449..214e2becbb 100644 --- a/django/core/management/templates.py +++ b/django/core/management/templates.py @@ -150,7 +150,6 @@ class TemplateCommand(BaseCommand): prefix_length = len(template_dir) + 1 for root, dirs, files in os.walk(template_dir): - path_rest = root[prefix_length:] relative_dir = path_rest.replace(base_name, name) if relative_dir: diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py index a3918bf9d2..c15d412846 100644 --- a/django/core/serializers/python.py +++ b/django/core/serializers/python.py @@ -122,8 +122,7 @@ def Deserializer( field_names = field_names_cache[Model] # Handle each field - for (field_name, field_value) in d["fields"].items(): - + for field_name, field_value in d["fields"].items(): if ignorenonexistent and field_name not in field_names: # skip fields no longer on model continue diff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py index 8a54f4061a..cbac8a7f76 100644 --- a/django/db/backends/base/creation.py +++ b/django/db/backends/base/creation.py @@ -116,6 +116,7 @@ class BaseDatabaseCreation: Designed only for test runner usage; will not handle large amounts of data. """ + # Iteratively return every object for all models to serialize. def get_objects(): from django.db.migrations.loader import MigrationLoader diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index dd29068495..835ead65ad 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -268,6 +268,7 @@ class BaseDatabaseOperations: exists for database backends to provide a better implementation according to their own quoting schemes. """ + # Convert params to contain string values. def to_string(s): return force_str(s, strings_only=True, errors="replace") diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index d6d303f0f0..1bbbcc111c 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -3,7 +3,6 @@ from django.db.models import NOT_PROVIDED class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): - sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s" sql_alter_column_null = "MODIFY %(column)s %(type)s NULL" diff --git a/django/db/backends/oracle/schema.py b/django/db/backends/oracle/schema.py index f2a5099110..86fd9ee497 100644 --- a/django/db/backends/oracle/schema.py +++ b/django/db/backends/oracle/schema.py @@ -11,7 +11,6 @@ from django.utils.duration import duration_iso_string class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): - sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s" sql_alter_column_type = "MODIFY %(column)s %(type)s" sql_alter_column_null = "MODIFY %(column)s NULL" diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index d95d7557f7..9d7fdc3a65 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -6,7 +6,6 @@ from django.db.backends.utils import strip_quotes class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): - # Setting all constraints to IMMEDIATE to allow changing data in the same # transaction. sql_update_with_default = ( diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py index 88fa466f79..dc4e29e942 100644 --- a/django/db/backends/sqlite3/schema.py +++ b/django/db/backends/sqlite3/schema.py @@ -11,7 +11,6 @@ from django.db.transaction import atomic class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): - sql_delete_table = "DROP TABLE %(table)s" sql_create_fk = None sql_create_inline_fk = ( @@ -191,6 +190,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): 4. Rename the "new__app_model" table to "app_model" 5. Restore any index of the previous "app_model" table. """ + # Self-referential fields must be recreated rather than copied from # the old model to ensure their remote_field.field_name doesn't refer # to an altered field. diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py index d505cd7904..b572c830e7 100644 --- a/django/db/backends/utils.py +++ b/django/db/backends/utils.py @@ -95,7 +95,6 @@ class CursorWrapper: class CursorDebugWrapper(CursorWrapper): - # XXX callproc isn't instrumented at this time. def execute(self, sql, params=None): diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py index 3a33b4aff7..537d2c9682 100644 --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -400,7 +400,7 @@ class RenameModel(ModelOperation): fields = zip( old_model._meta.local_many_to_many, new_model._meta.local_many_to_many ) - for (old_field, new_field) in fields: + for old_field, new_field in fields: # Skip self-referential fields as these are renamed above. if ( new_field.model == new_field.related_model @@ -505,7 +505,7 @@ class AlterModelTable(ModelOptionOperation): new_model._meta.db_table, ) # Rename M2M fields whose name is based on this model's db_table - for (old_field, new_field) in zip( + for old_field, new_field in zip( old_model._meta.local_many_to_many, new_model._meta.local_many_to_many ): if new_field.remote_field.through._meta.auto_created: diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 5ed7f8fae9..1869d86931 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -1089,7 +1089,6 @@ class Star(Expression): class Col(Expression): - contains_column_references = True possibly_multivalued = False diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 1a3a0ce5fc..91248cd1a5 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -221,7 +221,6 @@ class FileDescriptor(DeferredAttribute): class FileField(Field): - # The class to wrap instance attributes in. Accessing the file object off # the instance will always return an instance of attr_class. attr_class = FieldFile diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index bb4e065e37..4f15f9813f 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -344,7 +344,6 @@ class RelatedField(FieldCacheMixin, Field): return None def contribute_to_class(self, cls, name, private_only=False, **kwargs): - super().contribute_to_class(cls, name, private_only=private_only, **kwargs) self.opts = cls._meta @@ -540,7 +539,6 @@ class ForeignObject(RelatedField): swappable=True, **kwargs, ): - if rel is None: rel = self.rel_class( self, @@ -1623,7 +1621,6 @@ class ManyToManyField(RelatedField): (source_field_name, source), (target_field_name, target), ): - possible_field_names = [] for f in through._meta.fields: if ( diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.py index f833c09973..8b0bd70dbf 100644 --- a/django/db/models/functions/datetime.py +++ b/django/db/models/functions/datetime.py @@ -347,7 +347,6 @@ class TruncBase(TimezoneMixin, Transform): class Trunc(TruncBase): - # RemovedInDjango50Warning: when the deprecation ends, remove is_dst # argument. def __init__( diff --git a/django/db/models/options.py b/django/db/models/options.py index 3caad38072..1e0b8d297e 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -516,6 +516,7 @@ class Options: combined with filtering of field properties is the public API for obtaining this field list. """ + # For legacy reasons, the fields property should only contain forward # fields that are not private or with a m2m cardinality. Therefore we # pass these three filters as filters to the generator. diff --git a/django/db/models/query.py b/django/db/models/query.py index c7485b87fb..22a04f5cc2 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -586,7 +586,7 @@ class QuerySet: kwargs[arg.default_alias] = arg query = self.query.chain() - for (alias, aggregate_expr) in kwargs.items(): + for alias, aggregate_expr in kwargs.items(): query.add_annotation(aggregate_expr, alias, is_summary=True) annotation = query.annotations[alias] if not annotation.contains_aggregate: @@ -2100,7 +2100,7 @@ class RawQuerySet: """ columns = self.query.get_columns() # Adjust any column names which don't match field names - for (query_name, model_name) in self.translations.items(): + for query_name, model_name in self.translations.items(): # Ignore translations for nonexistent column names try: index = columns.index(query_name) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 71f2710a2b..972267b174 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -488,7 +488,6 @@ class ClearableFileInput(FileInput): if not self.is_required and CheckboxInput().value_from_datadict( data, files, self.clear_checkbox_name(name) ): - if upload: # If the user contradicts themselves (uploads a new file AND # checks the "clear" checkbox), we return a unique marker diff --git a/django/template/backends/base.py b/django/template/backends/base.py index 240733e6f4..991ce64cb7 100644 --- a/django/template/backends/base.py +++ b/django/template/backends/base.py @@ -5,7 +5,6 @@ from django.utils.functional import cached_property class BaseEngine: - # Core methods: engines have to provide their own implementation # (except for from_string which is optional). diff --git a/django/template/backends/django.py b/django/template/backends/django.py index 218e5e0bc1..d6d6fcfe71 100644 --- a/django/template/backends/django.py +++ b/django/template/backends/django.py @@ -12,7 +12,6 @@ from .base import BaseEngine class DjangoTemplates(BaseEngine): - app_dirname = "templates" def __init__(self, params): diff --git a/django/template/backends/dummy.py b/django/template/backends/dummy.py index 692382b6b1..cf0c0012a8 100644 --- a/django/template/backends/dummy.py +++ b/django/template/backends/dummy.py @@ -9,7 +9,6 @@ from .utils import csrf_input_lazy, csrf_token_lazy class TemplateStrings(BaseEngine): - app_dirname = "template_strings" def __init__(self, params): diff --git a/django/template/backends/jinja2.py b/django/template/backends/jinja2.py index 199d62b429..27621f315e 100644 --- a/django/template/backends/jinja2.py +++ b/django/template/backends/jinja2.py @@ -11,7 +11,6 @@ from .base import BaseEngine class Jinja2(BaseEngine): - app_dirname = "jinja2" def __init__(self, params): diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 59049069de..b10a811c7c 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -309,7 +309,6 @@ class IfNode(Node): def render(self, context): for condition, nodelist in self.conditions_nodelists: - if condition is not None: # if / elif clause try: match = condition.eval(context) diff --git a/django/test/client.py b/django/test/client.py index 60f4c37c3f..031601e314 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -256,7 +256,7 @@ def encode_multipart(boundary, data): # Each bit of the multipart form data could be either a form value or a # file, or a *list* of form values and/or files. Remember that HTTP field # names can be duplicated! - for (key, value) in data.items(): + for key, value in data.items(): if value is None: raise TypeError( "Cannot encode None for key '%s' as POST data. Did you mean " diff --git a/django/test/runner.py b/django/test/runner.py index 6bcf4111df..c83e7bbf1a 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -655,7 +655,6 @@ class DiscoverRunner: logger=None, **kwargs, ): - self.pattern = pattern self.top_level = top_level self.verbosity = verbosity diff --git a/django/test/testcases.py b/django/test/testcases.py index 53d3838bb8..059168c542 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -289,7 +289,6 @@ class _AssertFormErrorDeprecationHelper: class SimpleTestCase(unittest.TestCase): - # The class we'll use for the test client self.client. # Can be overridden in derived classes. client_class = Client @@ -788,7 +787,6 @@ class SimpleTestCase(unittest.TestCase): ) def _get_template_used(self, response, template_name, msg_prefix, method_name): - if response is None and template_name is None: raise TypeError("response and/or template_name argument must be provided") @@ -1145,7 +1143,6 @@ class SimpleTestCase(unittest.TestCase): class TransactionTestCase(SimpleTestCase): - # Subclasses can ask for resetting of auto increment sequence before each # test case reset_sequences = False diff --git a/django/utils/cache.py b/django/utils/cache.py index 90292ce4da..fd5337b8c7 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -80,7 +80,7 @@ def patch_cache_control(response, **kwargs): elif "public" in cc and "private" in kwargs: del cc["public"] - for (k, v) in kwargs.items(): + for k, v in kwargs.items(): directive = k.replace("_", "-") if directive == "no-cache": # no-cache supports multiple field names. diff --git a/django/utils/decorators.py b/django/utils/decorators.py index e412bb15e1..fb53983241 100644 --- a/django/utils/decorators.py +++ b/django/utils/decorators.py @@ -57,6 +57,7 @@ def method_decorator(decorator, name=""): """ Convert a function decorator into a method decorator """ + # 'obj' can be a class or a function. If 'obj' is a function at the time it # is passed to _dec, it will eventually be a method of the class it is # defined on. If 'obj' is a class, the 'name' is required to be the name diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py index 488d6a77cd..12f546bf9f 100644 --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -39,7 +39,6 @@ def format( if isinstance(number, float) and "e" in str(number).lower(): number = Decimal(str(number)) if isinstance(number, Decimal): - if decimal_pos is not None: # If the provided number is too small to affect any of the visible # decimal places, consider it equal to '0'. diff --git a/django/views/decorators/common.py b/django/views/decorators/common.py index 8c84688122..e231491ba9 100644 --- a/django/views/decorators/common.py +++ b/django/views/decorators/common.py @@ -6,6 +6,7 @@ def no_append_slash(view_func): Mark a view function as excluded from CommonMiddleware's APPEND_SLASH redirection. """ + # view_func.should_append_slash = False would also work, but decorators are # nicer if they don't have side effects, so return a new function. def wrapped_view(*args, **kwargs): diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py index 4841089ca8..0c8703a31e 100644 --- a/django/views/decorators/csrf.py +++ b/django/views/decorators/csrf.py @@ -48,6 +48,7 @@ uses the csrf_token template tag, or the CsrfViewMiddleware is used. def csrf_exempt(view_func): """Mark a view function as being exempt from the CSRF view protection.""" + # view_func.csrf_exempt = True would also work, but decorators are nicer # if they don't have side effects, so return a new function. def wrapped_view(*args, **kwargs): diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index 24c24a670b..7fe4fe4f11 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -1594,7 +1594,6 @@ class GetAdminLogTests(TestCase): @override_settings(ROOT_URLCONF="admin_changelist.urls") class SeleniumTests(AdminSeleniumTestCase): - available_apps = ["admin_changelist"] + AdminSeleniumTestCase.available_apps def setUp(self): diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index aab20dfd55..3cc37b61d7 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -1489,7 +1489,6 @@ class TestVerboseNameInlineForms(TestDataMixin, TestCase): @override_settings(ROOT_URLCONF="admin_inlines.urls") class SeleniumTests(AdminSeleniumTestCase): - available_apps = ["admin_inlines"] + AdminSeleniumTestCase.available_apps def setUp(self): diff --git a/tests/admin_scripts/another_app_waiting_migration/migrations/0001_initial.py b/tests/admin_scripts/another_app_waiting_migration/migrations/0001_initial.py index fc3acf7f5a..38ecc948e4 100644 --- a/tests/admin_scripts/another_app_waiting_migration/migrations/0001_initial.py +++ b/tests/admin_scripts/another_app_waiting_migration/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/tests/admin_scripts/app_waiting_migration/migrations/0001_initial.py b/tests/admin_scripts/app_waiting_migration/migrations/0001_initial.py index 7de6e2001b..2f9819dbb1 100644 --- a/tests/admin_scripts/app_waiting_migration/migrations/0001_initial.py +++ b/tests/admin_scripts/app_waiting_migration/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/tests/admin_scripts/management/commands/suppress_base_options_command.py b/tests/admin_scripts/management/commands/suppress_base_options_command.py index 24df0f4dd7..4ef386dbbd 100644 --- a/tests/admin_scripts/management/commands/suppress_base_options_command.py +++ b/tests/admin_scripts/management/commands/suppress_base_options_command.py @@ -2,7 +2,6 @@ from django.core.management import BaseCommand class Command(BaseCommand): - help = "Test suppress base options command." requires_system_checks = [] suppressed_base_arguments = { diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 005ccb3312..4f40322f5f 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -2363,7 +2363,6 @@ class ExecuteFromCommandLine(SimpleTestCase): @override_settings(ROOT_URLCONF="admin_scripts.urls") class StartProject(LiveServerTestCase, AdminScriptTestCase): - available_apps = [ "admin_scripts", "django.contrib.auth", diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py index a2ef3b1942..113f5f7024 100644 --- a/tests/admin_utils/tests.py +++ b/tests/admin_utils/tests.py @@ -99,7 +99,6 @@ class NestedObjectsTests(TestCase): class UtilsTests(SimpleTestCase): - empty_value = "-empty-" def test_values_from_lookup_field(self): diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 1c50cb1fd3..624e39e6ed 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -5548,7 +5548,6 @@ class PrePopulatedTest(TestCase): @override_settings(ROOT_URLCONF="admin_views.urls") class SeleniumTests(AdminSeleniumTestCase): - available_apps = ["admin_views"] + AdminSeleniumTestCase.available_apps def setUp(self): diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 55f513c0e9..43e2de9dc7 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -73,6 +73,7 @@ class AdminFormfieldForDBFieldTests(SimpleTestCase): Helper to call formfield_for_dbfield for a given model and field name and verify that the returned formfield is appropriate. """ + # Override any settings on the model admin class MyModelAdmin(admin.ModelAdmin): pass @@ -317,7 +318,6 @@ class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase): ) def test_invalid_target_id(self): - for test_str in ("Iñtërnâtiônàlizætiøn", "1234'", -1234): # This should result in an error message, not a server exception. response = self.client.post( @@ -886,7 +886,6 @@ class RelatedFieldWidgetWrapperTests(SimpleTestCase): @override_settings(ROOT_URLCONF="admin_widgets.urls") class AdminWidgetSeleniumTestCase(AdminSeleniumTestCase): - available_apps = ["admin_widgets"] + AdminSeleniumTestCase.available_apps def setUp(self): @@ -1086,7 +1085,6 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase): # Test with every locale with override_settings(LANGUAGE_CODE=language_code): - # Open a page that has a date picker widget url = reverse("admin:admin_widgets_member_change", args=(member.pk,)) self.selenium.get(self.live_server_url + url) diff --git a/tests/aggregation/test_filter_argument.py b/tests/aggregation/test_filter_argument.py index f55e06dfa0..c7c5da7280 100644 --- a/tests/aggregation/test_filter_argument.py +++ b/tests/aggregation/test_filter_argument.py @@ -139,7 +139,9 @@ class FilteredAggregateTests(TestCase): self.assertEqual(qs.get(pk__in=qs.values("pk")), self.a1) def test_filtered_aggregate_ref_annotation(self): - aggs = Author.objects.annotate(double_age=F("age") * 2,).aggregate( + aggs = Author.objects.annotate( + double_age=F("age") * 2, + ).aggregate( cnt=Count("pk", filter=Q(double_age__gt=100)), ) self.assertEqual(aggs["cnt"], 2) diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index bbd4620710..d1aae961a6 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1259,7 +1259,9 @@ class AggregateTestCase(TestCase): def test_aggregate_over_aggregate(self): msg = "Cannot compute Avg('age'): 'age' is an aggregate" with self.assertRaisesMessage(FieldError, msg): - Author.objects.annotate(age_alias=F("age"),).aggregate( + Author.objects.annotate( + age_alias=F("age"), + ).aggregate( age=Sum(F("age")), avg_age=Avg(F("age")), ) diff --git a/tests/auth_tests/test_mixins.py b/tests/auth_tests/test_mixins.py index fc92175f38..df3479cb23 100644 --- a/tests/auth_tests/test_mixins.py +++ b/tests/auth_tests/test_mixins.py @@ -51,7 +51,6 @@ class StackedMixinsView2( class AccessMixinTests(TestCase): - factory = RequestFactory() def test_stacked_mixins_success(self): @@ -134,7 +133,6 @@ class AccessMixinTests(TestCase): class UserPassesTestTests(SimpleTestCase): - factory = RequestFactory() def _test_redirect(self, view=None, url="/accounts/login/?next=/rand"): @@ -213,7 +211,6 @@ class UserPassesTestTests(SimpleTestCase): class LoginRequiredMixinTests(TestCase): - factory = RequestFactory() @classmethod @@ -243,7 +240,6 @@ class LoginRequiredMixinTests(TestCase): class PermissionsRequiredMixinTests(TestCase): - factory = RequestFactory() @classmethod diff --git a/tests/auth_tests/test_remote_user.py b/tests/auth_tests/test_remote_user.py index 9e6e0dce20..32e4509d1a 100644 --- a/tests/auth_tests/test_remote_user.py +++ b/tests/auth_tests/test_remote_user.py @@ -18,7 +18,6 @@ from django.utils.deprecation import RemovedInDjango50Warning @override_settings(ROOT_URLCONF="auth_tests.urls") class RemoteUserTest(TestCase): - middleware = "django.contrib.auth.middleware.RemoteUserMiddleware" backend = "django.contrib.auth.backends.RemoteUserBackend" header = "REMOTE_USER" diff --git a/tests/backends/mysql/tests.py b/tests/backends/mysql/tests.py index 234b4df441..7708f52a07 100644 --- a/tests/backends/mysql/tests.py +++ b/tests/backends/mysql/tests.py @@ -17,7 +17,6 @@ def get_connection(): @override_settings(DEBUG=True) @unittest.skipUnless(connection.vendor == "mysql", "MySQL tests") class IsolationLevelTests(TestCase): - read_committed = "read committed" repeatable_read = "repeatable read" isolation_values = { diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py index 0669d26191..cddd815187 100644 --- a/tests/backends/sqlite/tests.py +++ b/tests/backends/sqlite/tests.py @@ -117,7 +117,6 @@ class Tests(TestCase): @unittest.skipUnless(connection.vendor == "sqlite", "SQLite tests") @isolate_apps("backends") class SchemaTests(TransactionTestCase): - available_apps = ["backends"] def test_autoincrement(self): diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 9303089b51..3559f93eec 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -213,7 +213,6 @@ class SequenceResetTest(TestCase): # This test needs to run outside of a transaction, otherwise closing the # connection would implicitly rollback and cause problems during teardown. class ConnectionCreatedSignalTest(TransactionTestCase): - available_apps = [] # Unfortunately with sqlite3 the in-memory test database cannot be closed, @@ -263,7 +262,6 @@ class EscapingChecksDebug(EscapingChecks): class BackendTestCase(TransactionTestCase): - available_apps = ["backends"] def create_squares_with_executemany(self, args): @@ -563,7 +561,6 @@ class BackendTestCase(TransactionTestCase): # These tests aren't conditional because it would require differentiating # between MySQL+InnoDB and MySQL+MYISAM (something we currently can't do). class FkConstraintsTests(TransactionTestCase): - available_apps = ["backends"] def setUp(self): @@ -719,7 +716,6 @@ class FkConstraintsTests(TransactionTestCase): class ThreadTests(TransactionTestCase): - available_apps = ["backends"] def test_default_connection_thread_local(self): diff --git a/tests/basic/tests.py b/tests/basic/tests.py index e27fb66e3d..b1d83ba977 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -627,7 +627,6 @@ class ModelLookupTest(TestCase): class ConcurrentSaveTests(TransactionTestCase): - available_apps = ["basic"] @skipUnlessDBFeature("test_db_allows_multiple_connections") diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 4a102d0cc2..b3aca19b73 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -209,7 +209,7 @@ class DummyCacheTests(SimpleTestCase): "Iñtërnâtiônàlizætiøn": "Iñtërnâtiônàlizætiøn2", "ascii2": {"x": 1}, } - for (key, value) in stuff.items(): + for key, value in stuff.items(): with self.subTest(key=key): cache.set(key, value) self.assertIsNone(cache.get(key)) @@ -514,23 +514,23 @@ class BaseCacheTests: "ascii2": {"x": 1}, } # Test `set` - for (key, value) in stuff.items(): + for key, value in stuff.items(): with self.subTest(key=key): cache.set(key, value) self.assertEqual(cache.get(key), value) # Test `add` - for (key, value) in stuff.items(): + for key, value in stuff.items(): with self.subTest(key=key): self.assertIs(cache.delete(key), True) self.assertIs(cache.add(key, value), True) self.assertEqual(cache.get(key), value) # Test `set_many` - for (key, value) in stuff.items(): + for key, value in stuff.items(): self.assertIs(cache.delete(key), True) cache.set_many(stuff) - for (key, value) in stuff.items(): + for key, value in stuff.items(): with self.subTest(key=key): self.assertEqual(cache.get(key), value) @@ -698,6 +698,7 @@ class BaseCacheTests: portable caching code without making it too difficult to use production backends with more liberal key rules. Refs #6447. """ + # mimic custom ``make_key`` method being defined since the default will # never show the below warnings def func(key, *args): @@ -796,7 +797,6 @@ class BaseCacheTests: self.assertIsNone(caches["v2"].get("answer4", version=2)) def test_cache_versioning_add(self): - # add, default version = 1, but manually override version = 2 self.assertIs(cache.add("answer1", 42, version=2), True) self.assertIsNone(cache.get("answer1", version=1)) @@ -1143,7 +1143,6 @@ class BaseCacheTests: ) ) class DBCacheTests(BaseCacheTests, TransactionTestCase): - available_apps = ["cache"] def setUp(self): @@ -1462,7 +1461,6 @@ redis_excluded_caches = {"cull", "zero_cull"} class BaseMemcachedTests(BaseCacheTests): - # By default it's assumed that the client doesn't clean up connections # properly, in which case the backend must do so after each request. should_disconnect_on_close = True diff --git a/tests/contenttypes_tests/operations_migrations/0001_initial.py b/tests/contenttypes_tests/operations_migrations/0001_initial.py index 0c8e96038e..563a2f070c 100644 --- a/tests/contenttypes_tests/operations_migrations/0001_initial.py +++ b/tests/contenttypes_tests/operations_migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Foo", diff --git a/tests/contenttypes_tests/operations_migrations/0002_rename_foo.py b/tests/contenttypes_tests/operations_migrations/0002_rename_foo.py index e40a33ac0b..10e05ddb60 100644 --- a/tests/contenttypes_tests/operations_migrations/0002_rename_foo.py +++ b/tests/contenttypes_tests/operations_migrations/0002_rename_foo.py @@ -24,7 +24,6 @@ def assert_foo_contenttype_not_cached(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("contenttypes_tests", "0001_initial"), ] diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 6db67c9190..ba8f87d6ac 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -45,7 +45,6 @@ MASKED_TEST_SECRET2 = "2JgchWvM1tpxT2lfz9aydoXW9yT1DN3NdLiejYxOOlzzV4nhBbYqmqZYb class CsrfFunctionTestMixin: - # This method depends on _unmask_cipher_token() being correct. def assertMaskedSecretCorrect(self, masked_secret, secret): """Test that a string is a valid masked version of a secret.""" diff --git a/tests/db_functions/migrations/0002_create_test_models.py b/tests/db_functions/migrations/0002_create_test_models.py index 4f72f4e854..37ee93f92f 100644 --- a/tests/db_functions/migrations/0002_create_test_models.py +++ b/tests/db_functions/migrations/0002_create_test_models.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("db_functions", "0001_setup_extensions"), ] diff --git a/tests/delete_regress/tests.py b/tests/delete_regress/tests.py index c9d0ff8d0a..bca65aa7f6 100644 --- a/tests/delete_regress/tests.py +++ b/tests/delete_regress/tests.py @@ -45,7 +45,6 @@ from .models import ( # get two connections to an in-memory database. @skipUnlessDBFeature("test_db_allows_multiple_connections") class DeleteLockingTest(TransactionTestCase): - available_apps = ["delete_regress"] def setUp(self): @@ -126,7 +125,6 @@ class DeleteCascadeTests(TestCase): class DeleteCascadeTransactionTests(TransactionTestCase): - available_apps = ["delete_regress"] def test_inheritance(self): diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index e66007d2d4..bd9472cec3 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -1171,7 +1171,6 @@ class NonexistentFixtureTests(TestCase): class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase): - available_apps = [ "fixtures", "django.contrib.sites", diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index 8c9228f675..ba54d08fc8 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -921,7 +921,6 @@ class M2MNaturalKeyFixtureTests(TestCase): class TestTicket11101(TransactionTestCase): - available_apps = ["fixtures_regress"] @skipUnlessDBFeature("supports_transactions") diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index fc41c043f5..f415df943d 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -93,7 +93,6 @@ class MultiColumnFKTests(TestCase): self.assertIs(membership.person, self.bob) def test_query_filters_correctly(self): - # Creating a to valid memberships Membership.objects.create( membership_country_id=self.usa.id, @@ -120,7 +119,6 @@ class MultiColumnFKTests(TestCase): ) def test_reverse_query_filters_correctly(self): - timemark = datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None) timedelta = datetime.timedelta(days=1) diff --git a/tests/forms_tests/field_tests/test_floatfield.py b/tests/forms_tests/field_tests/test_floatfield.py index 94676fb9ee..36a5c04397 100644 --- a/tests/forms_tests/field_tests/test_floatfield.py +++ b/tests/forms_tests/field_tests/test_floatfield.py @@ -143,7 +143,6 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase): @override_settings(ROOT_URLCONF="forms_tests.urls") class FloatFieldHTMLTest(SeleniumTestCase): - available_apps = ["forms_tests"] def test_float_field_rendering_passes_client_side_validation(self): diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index e28c1f2462..2718b1d2f1 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -7,7 +7,6 @@ from ..models import Article @override_settings(ROOT_URLCONF="forms_tests.urls") class LiveWidgetTests(AdminSeleniumTestCase): - available_apps = ["forms_tests"] + AdminSeleniumTestCase.available_apps def test_textarea_trailing_newlines(self): diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py index b139d1089b..add485245a 100644 --- a/tests/generic_views/test_base.py +++ b/tests/generic_views/test_base.py @@ -300,7 +300,6 @@ class ViewTest(SimpleTestCase): @override_settings(ROOT_URLCONF="generic_views.urls") class TemplateViewTest(SimpleTestCase): - rf = RequestFactory() def _assert_about(self, response): @@ -427,7 +426,6 @@ class TemplateViewTest(SimpleTestCase): @override_settings(ROOT_URLCONF="generic_views.urls") class RedirectViewTest(SimpleTestCase): - rf = RequestFactory() def test_no_url(self): diff --git a/tests/generic_views/views.py b/tests/generic_views/views.py index 5c4c9739d2..5348c67632 100644 --- a/tests/generic_views/views.py +++ b/tests/generic_views/views.py @@ -330,7 +330,6 @@ class NonModel: class NonModelDetail(generic.DetailView): - template_name = "generic_views/detail.html" model = NonModel diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py index a2821187b2..b439bc4660 100644 --- a/tests/get_or_create/tests.py +++ b/tests/get_or_create/tests.py @@ -260,7 +260,6 @@ class GetOrCreateTestsWithManualPKs(TestCase): class GetOrCreateTransactionTests(TransactionTestCase): - available_apps = ["get_or_create"] def test_get_or_create_integrityerror(self): diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index f510b925ff..95b9b6adef 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -1292,6 +1292,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): def test_pickle(self): "Testing pickling and unpickling support." + # Creating a list of test geometries for pickling, # and setting the SRID on some of them. def get_geoms(lst, srid=None): diff --git a/tests/gis_tests/inspectapp/models.py b/tests/gis_tests/inspectapp/models.py index da36e8c8b2..037fd8300e 100644 --- a/tests/gis_tests/inspectapp/models.py +++ b/tests/gis_tests/inspectapp/models.py @@ -2,7 +2,6 @@ from django.contrib.gis.db import models class AllOGRFields(models.Model): - f_decimal = models.FloatField() f_float = models.FloatField() f_int = models.IntegerField() diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py index 89e430d2c9..283149eafc 100644 --- a/tests/gis_tests/layermap/tests.py +++ b/tests/gis_tests/layermap/tests.py @@ -233,6 +233,7 @@ class LayerMapTest(TestCase): def test_test_fid_range_step(self): "Tests the `fid_range` keyword and the `step` keyword of .save()." + # Function for clearing out all the counties before testing. def clear_counties(): County.objects.all().delete() diff --git a/tests/gis_tests/rasterapp/migrations/0002_rastermodels.py b/tests/gis_tests/rasterapp/migrations/0002_rastermodels.py index 68b77f1d85..bd2a72ab45 100644 --- a/tests/gis_tests/rasterapp/migrations/0002_rastermodels.py +++ b/tests/gis_tests/rasterapp/migrations/0002_rastermodels.py @@ -4,7 +4,6 @@ from django.db.models import deletion class Migration(migrations.Migration): - dependencies = [ ("rasterapp", "0001_setup_extensions"), ] diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index 1e2da4672b..6716b138ee 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -95,7 +95,6 @@ class HandlerTests(SimpleTestCase): @override_settings(ROOT_URLCONF="handlers.urls", MIDDLEWARE=[]) class TransactionsPerRequestTests(TransactionTestCase): - available_apps = [] def test_no_transaction(self): diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py index 259a9668b8..ab74927c40 100644 --- a/tests/i18n/test_compilation.py +++ b/tests/i18n/test_compilation.py @@ -22,12 +22,10 @@ has_msgfmt = find_command("msgfmt") @unittest.skipUnless(has_msgfmt, "msgfmt is mandatory for compilation tests") class MessageCompilationTests(RunInTmpDirMixin, SimpleTestCase): - work_subdir = "commands" class PoFileTests(MessageCompilationTests): - LOCALE = "es_AR" MO_FILE = "locale/%s/LC_MESSAGES/django.mo" % LOCALE MO_FILE_EN = "locale/en/LC_MESSAGES/django.mo" @@ -83,7 +81,6 @@ class PoFileContentsTests(MessageCompilationTests): class MultipleLocaleCompilationTests(MessageCompilationTests): - MO_FILE_HR = None MO_FILE_FR = None @@ -108,7 +105,6 @@ class MultipleLocaleCompilationTests(MessageCompilationTests): class ExcludedLocaleCompilationTests(MessageCompilationTests): - work_subdir = "exclude" MO_FILE = "locale/%s/LC_MESSAGES/django.mo" diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index c2ae10efd8..1665c82be2 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -33,7 +33,6 @@ requires_gettext_019 = skipIf( @skipUnless(has_xgettext, "xgettext is mandatory for extraction tests") class ExtractorTests(POFileAssertionMixin, RunInTmpDirMixin, SimpleTestCase): - work_subdir = "commands" PO_FILE = "locale/%s/LC_MESSAGES/django.po" % LOCALE @@ -509,7 +508,6 @@ class BasicExtractorTests(ExtractorTests): class JavaScriptExtractorTests(ExtractorTests): - PO_FILE = "locale/%s/LC_MESSAGES/djangojs.po" % LOCALE def test_javascript_literals(self): @@ -622,7 +620,6 @@ class SymlinkExtractorTests(ExtractorTests): class CopyPluralFormsExtractorTests(ExtractorTests): - PO_FILE_ES = "locale/es/LC_MESSAGES/django.po" def test_copy_plural_forms(self): @@ -788,7 +785,6 @@ class LocationCommentsTests(ExtractorTests): class KeepPotFileExtractorTests(ExtractorTests): - POT_FILE = "locale/django.pot" def test_keep_pot_disabled_by_default(self): @@ -833,7 +829,6 @@ class MultipleLocaleExtractionTests(ExtractorTests): class ExcludedLocaleExtractionTests(ExtractorTests): - work_subdir = "exclude" LOCALES = ["en", "fr", "it"] @@ -888,7 +883,6 @@ class ExcludedLocaleExtractionTests(ExtractorTests): class CustomLayoutExtractionTests(ExtractorTests): - work_subdir = "project_dir" def test_no_locale_raises(self): diff --git a/tests/indexes/models.py b/tests/indexes/models.py index 241556ca69..ef62ad311d 100644 --- a/tests/indexes/models.py +++ b/tests/indexes/models.py @@ -18,7 +18,6 @@ class CurrentTranslation(models.ForeignObject): class ArticleTranslation(models.Model): - article = models.ForeignKey("indexes.Article", models.CASCADE) article_no_constraint = models.ForeignKey( "indexes.Article", models.CASCADE, db_constraint=False, related_name="+" diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index a877f25e56..8ecba7ea09 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -16,7 +16,6 @@ from .models import ( class IntrospectionTests(TransactionTestCase): - available_apps = ["introspection"] def test_table_names(self): diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py index 08aca62850..b06588efb7 100644 --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -745,6 +745,7 @@ class FieldNamesTests(TestCase): #13711 -- Model check for long M2M column names when database has column name length limits. """ + # A model with very long name which will be used to set relations to. class VeryLongModelNamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( models.Model diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py index 5b4bb45ff8..cc958164be 100644 --- a/tests/invalid_models_tests/test_relative_fields.py +++ b/tests/invalid_models_tests/test_relative_fields.py @@ -1593,7 +1593,6 @@ class SelfReferentialFKClashTests(SimpleTestCase): @isolate_apps("invalid_models_tests") class ComplexClashTests(SimpleTestCase): - # New tests should not be included here, because this is a single, # self-contained sanity check, not a test of everything. def test_complex_clash(self): diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 11a277d7e0..e17e18acbd 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -1212,7 +1212,9 @@ class LookupTests(TestCase): def test_exact_exists(self): qs = Article.objects.filter(pk=OuterRef("pk")) - seasons = Season.objects.annotate(pk_exists=Exists(qs),).filter( + seasons = Season.objects.annotate( + pk_exists=Exists(qs), + ).filter( pk_exists=Exists(qs), ) self.assertCountEqual(seasons, Season.objects.all()) diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py index cb40b36321..aad520e598 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -36,7 +36,6 @@ def get_response_404(request): @override_settings(ROOT_URLCONF="middleware.urls") class CommonMiddlewareTest(SimpleTestCase): - rf = RequestFactory() @override_settings(APPEND_SLASH=True) @@ -379,7 +378,6 @@ class CommonMiddlewareTest(SimpleTestCase): MANAGERS=[("PHD", "PHB@dilbert.com")], ) class BrokenLinkEmailsMiddlewareTest(SimpleTestCase): - rf = RequestFactory() def setUp(self): diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py index 4ece6ccb11..4f4ce5f2f8 100644 --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -172,7 +172,6 @@ class MyMiddlewareWithExceptionMessage: MIDDLEWARE=["django.middleware.common.CommonMiddleware"], ) class MiddlewareNotUsedTests(SimpleTestCase): - rf = RequestFactory() def test_raise_exception(self): diff --git a/tests/migrate_signals/custom_migrations/0001_initial.py b/tests/migrate_signals/custom_migrations/0001_initial.py index 91b106ef0c..d90e477070 100644 --- a/tests/migrate_signals/custom_migrations/0001_initial.py +++ b/tests/migrate_signals/custom_migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Signal", diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py index f5b3cb506f..86e5b2a7ee 100644 --- a/tests/migrate_signals/tests.py +++ b/tests/migrate_signals/tests.py @@ -67,7 +67,6 @@ post_migrate_receiver = OneTimeReceiver(signals.post_migrate) class MigrateSignalTests(TransactionTestCase): - available_apps = ["migrate_signals"] def test_call_time(self): diff --git a/tests/migration_test_data_persistence/migrations/0001_initial.py b/tests/migration_test_data_persistence/migrations/0001_initial.py index f92b88bc2c..f9a75e29b8 100644 --- a/tests/migration_test_data_persistence/migrations/0001_initial.py +++ b/tests/migration_test_data_persistence/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migration_test_data_persistence/migrations/0002_add_book.py b/tests/migration_test_data_persistence/migrations/0002_add_book.py index 51c13effd9..c355428f34 100644 --- a/tests/migration_test_data_persistence/migrations/0002_add_book.py +++ b/tests/migration_test_data_persistence/migrations/0002_add_book.py @@ -10,7 +10,6 @@ def add_book(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [("migration_test_data_persistence", "0001_initial")] operations = [ diff --git a/tests/migrations/deprecated_field_migrations/0001_initial.py b/tests/migrations/deprecated_field_migrations/0001_initial.py index b5d606c8ad..6f834ab87d 100644 --- a/tests/migrations/deprecated_field_migrations/0001_initial.py +++ b/tests/migrations/deprecated_field_migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/deprecated_field_migrations/0002_remove_ipaddressfield_ip.py b/tests/migrations/deprecated_field_migrations/0002_remove_ipaddressfield_ip.py index 019b80fddf..5f831037b2 100644 --- a/tests/migrations/deprecated_field_migrations/0002_remove_ipaddressfield_ip.py +++ b/tests/migrations/deprecated_field_migrations/0002_remove_ipaddressfield_ip.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0001_initial.py index c7cf43a233..8910c6f115 100644 --- a/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0002_alter_id.py b/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0002_alter_id.py index cd18df17f3..66d8757534 100644 --- a/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0002_alter_id.py +++ b/tests/migrations/migrations_test_apps/alter_fk/author_app/migrations/0002_alter_id.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("author_app", "0001_initial"), ("book_app", "0001_initial"), # Forces the book table to alter the FK diff --git a/tests/migrations/migrations_test_apps/alter_fk/book_app/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/alter_fk/book_app/migrations/0001_initial.py index 72c11285d6..5ee7169220 100644 --- a/tests/migrations/migrations_test_apps/alter_fk/book_app/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/alter_fk/book_app/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("author_app", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_conflicting_second.py b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_conflicting_second.py index 16fd7dbfee..c176e1f0c3 100644 --- a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_conflicting_second.py +++ b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_conflicting_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("conflicting_app_with_dependencies", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_second.py b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_second.py index 7c581f158f..86c12e7c2a 100644 --- a/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_second.py +++ b/tests/migrations/migrations_test_apps/conflicting_app_with_dependencies/migrations/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("conflicting_app_with_dependencies", "0001_initial"), ("migrated_app", "0001_initial"), diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py index eef91811cb..de3a217656 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py index 573909f9a7..abd02fa857 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py +++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_a", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py index d1caeb2284..43cf2d9fe0 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py +++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_c", "0002_c2"), ("lookuperror_b", "0002_b2"), diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py index 060bc499f5..f26e090fb0 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py +++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_a", "0003_a3"), ] diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py index af48c80d3c..1479afe84d 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py index 87ab4c3194..6c506da673 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py +++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_a", "0002_a2"), ("lookuperror_b", "0001_initial"), diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py index e068563dd1..adfcd171bb 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py +++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_b", "0002_b2"), ] diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py index 523259fd26..1db74afb84 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py index 3699db274b..0e3fd72db3 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py +++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_a", "0002_a2"), ("lookuperror_c", "0001_initial"), diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py index 8be34afa6b..4229faea6d 100644 --- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py +++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("lookuperror_c", "0002_c2"), ] diff --git a/tests/migrations/migrations_test_apps/migrated_app/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/migrated_app/migrations/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/migrations_test_apps/migrated_app/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/migrated_app/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/migrations_test_apps/migrated_unapplied_app/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/migrated_unapplied_app/migrations/0001_initial.py index 551f597562..809b5673c8 100644 --- a/tests/migrations/migrations_test_apps/migrated_unapplied_app/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/migrated_unapplied_app/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "OtherAuthor", diff --git a/tests/migrations/migrations_test_apps/mutate_state_a/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/mutate_state_a/migrations/0001_initial.py index 4da5347412..a71e330166 100644 --- a/tests/migrations/migrations_test_apps/mutate_state_a/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/mutate_state_a/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("mutate_state_b", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0001_initial.py index 4d5e712d66..aa8550e4f4 100644 --- a/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0002_add_field.py b/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0002_add_field.py index fcd8a9337a..15278e5dd7 100644 --- a/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0002_add_field.py +++ b/tests/migrations/migrations_test_apps/mutate_state_b/migrations/0002_add_field.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("mutate_state_b", "0001_initial"), ] diff --git a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0001_initial.py +++ b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_conflicting_second.py b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_conflicting_second.py index 385420e98b..5817f30692 100644 --- a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_conflicting_second.py +++ b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_conflicting_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("unspecified_app_with_conflict", "0001_initial")] operations = [ diff --git a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_second.py b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_second.py index 8da324aaff..506b3306c2 100644 --- a/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_second.py +++ b/tests/migrations/migrations_test_apps/unspecified_app_with_conflict/migrations/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("unspecified_app_with_conflict", "0001_initial")] operations = [ diff --git a/tests/migrations/test_add_many_to_many_field_initial/0001_initial.py b/tests/migrations/test_add_many_to_many_field_initial/0001_initial.py index e7e7d59633..6547a71e7a 100644 --- a/tests/migrations/test_add_many_to_many_field_initial/0001_initial.py +++ b/tests/migrations/test_add_many_to_many_field_initial/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/tests/migrations/test_add_many_to_many_field_initial/0002_initial.py b/tests/migrations/test_add_many_to_many_field_initial/0002_initial.py index 928e4ea1c9..2ab642d7cc 100644 --- a/tests/migrations/test_add_many_to_many_field_initial/0002_initial.py +++ b/tests/migrations/test_add_many_to_many_field_initial/0002_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/tests/migrations/test_auto_now_add/0001_initial.py b/tests/migrations/test_auto_now_add/0001_initial.py index e7fafc96c6..cd8dff800f 100644 --- a/tests/migrations/test_auto_now_add/0001_initial.py +++ b/tests/migrations/test_auto_now_add/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True operations = [ diff --git a/tests/migrations/test_migrations/0001_initial.py b/tests/migrations/test_migrations/0001_initial.py index 72cf48c7aa..20ca1391f6 100644 --- a/tests/migrations/test_migrations/0001_initial.py +++ b/tests/migrations/test_migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True operations = [ diff --git a/tests/migrations/test_migrations/0002_second.py b/tests/migrations/test_migrations/0002_second.py index 90a1b13b0b..059b7ba2e7 100644 --- a/tests/migrations/test_migrations/0002_second.py +++ b/tests/migrations/test_migrations/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/test_migrations_conflict/0001_initial.py b/tests/migrations/test_migrations_conflict/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/test_migrations_conflict/0001_initial.py +++ b/tests/migrations/test_migrations_conflict/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_conflict/0002_conflicting_second.py b/tests/migrations/test_migrations_conflict/0002_conflicting_second.py index d542d12dd5..8b73eb7714 100644 --- a/tests/migrations/test_migrations_conflict/0002_conflicting_second.py +++ b/tests/migrations/test_migrations_conflict/0002_conflicting_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("migrations", "0001_initial")] operations = [ diff --git a/tests/migrations/test_migrations_conflict/0002_second.py b/tests/migrations/test_migrations_conflict/0002_second.py index 9b4c3264d6..55d3b9aaad 100644 --- a/tests/migrations/test_migrations_conflict/0002_second.py +++ b/tests/migrations/test_migrations_conflict/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("migrations", "0001_initial")] operations = [ diff --git a/tests/migrations/test_migrations_fake_split_initial/0001_initial.py b/tests/migrations/test_migrations_fake_split_initial/0001_initial.py index f96d1b57cd..99bf99b615 100644 --- a/tests/migrations/test_migrations_fake_split_initial/0001_initial.py +++ b/tests/migrations/test_migrations_fake_split_initial/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True operations = [ diff --git a/tests/migrations/test_migrations_fake_split_initial/0002_second.py b/tests/migrations/test_migrations_fake_split_initial/0002_second.py index ba8e9660d1..e9ad8b2b03 100644 --- a/tests/migrations/test_migrations_fake_split_initial/0002_second.py +++ b/tests/migrations/test_migrations_fake_split_initial/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/tests/migrations/test_migrations_first/second.py b/tests/migrations/test_migrations_first/second.py index 96550a7b0c..3a02a8b867 100644 --- a/tests/migrations/test_migrations_first/second.py +++ b/tests/migrations/test_migrations_first/second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "thefirst"), ("migrations2", "0002_second"), diff --git a/tests/migrations/test_migrations_first/thefirst.py b/tests/migrations/test_migrations_first/thefirst.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/test_migrations_first/thefirst.py +++ b/tests/migrations/test_migrations_first/thefirst.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_initial_false/0001_not_initial.py b/tests/migrations/test_migrations_initial_false/0001_not_initial.py index dbf58e4428..d358944e8c 100644 --- a/tests/migrations/test_migrations_initial_false/0001_not_initial.py +++ b/tests/migrations/test_migrations_initial_false/0001_not_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = False operations = [ diff --git a/tests/migrations/test_migrations_no_ancestor/0001_initial.py b/tests/migrations/test_migrations_no_ancestor/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/test_migrations_no_ancestor/0001_initial.py +++ b/tests/migrations/test_migrations_no_ancestor/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_no_ancestor/0002_conflicting_second.py b/tests/migrations/test_migrations_no_ancestor/0002_conflicting_second.py index fe1e0d3686..2765b16f85 100644 --- a/tests/migrations/test_migrations_no_ancestor/0002_conflicting_second.py +++ b/tests/migrations/test_migrations_no_ancestor/0002_conflicting_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/test_migrations_no_ancestor/0002_second.py b/tests/migrations/test_migrations_no_ancestor/0002_second.py index 90a1b13b0b..059b7ba2e7 100644 --- a/tests/migrations/test_migrations_no_ancestor/0002_second.py +++ b/tests/migrations/test_migrations_no_ancestor/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/test_migrations_no_changes/0001_initial.py b/tests/migrations/test_migrations_no_changes/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/test_migrations_no_changes/0001_initial.py +++ b/tests/migrations/test_migrations_no_changes/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_no_changes/0002_second.py b/tests/migrations/test_migrations_no_changes/0002_second.py index 90a1b13b0b..059b7ba2e7 100644 --- a/tests/migrations/test_migrations_no_changes/0002_second.py +++ b/tests/migrations/test_migrations_no_changes/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/test_migrations_no_changes/0003_third.py b/tests/migrations/test_migrations_no_changes/0003_third.py index 8802926437..e810902a40 100644 --- a/tests/migrations/test_migrations_no_changes/0003_third.py +++ b/tests/migrations/test_migrations_no_changes/0003_third.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0002_second"), ] diff --git a/tests/migrations/test_migrations_no_default/0001_initial.py b/tests/migrations/test_migrations_no_default/0001_initial.py index b247e49271..5be2a9268e 100644 --- a/tests/migrations/test_migrations_no_default/0001_initial.py +++ b/tests/migrations/test_migrations_no_default/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/migrations/test_migrations_noop/0001_initial.py b/tests/migrations/test_migrations_noop/0001_initial.py index f06ff893ad..b74b561c25 100644 --- a/tests/migrations/test_migrations_noop/0001_initial.py +++ b/tests/migrations/test_migrations_noop/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - initial = True operations = [ diff --git a/tests/migrations/test_migrations_order/0001.py b/tests/migrations/test_migrations_order/0001.py index ee34de77e4..94447f8339 100644 --- a/tests/migrations/test_migrations_order/0001.py +++ b/tests/migrations/test_migrations_order/0001.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - initial = True operations = [] diff --git a/tests/migrations/test_migrations_plan/0001_initial.py b/tests/migrations/test_migrations_plan/0001_initial.py index 4e4338c89b..9f60a2efd7 100644 --- a/tests/migrations/test_migrations_plan/0001_initial.py +++ b/tests/migrations/test_migrations_plan/0001_initial.py @@ -12,7 +12,6 @@ def shrink_tail(x, y): class Migration(migrations.Migration): - initial = True operations = [ diff --git a/tests/migrations/test_migrations_plan/0002_second.py b/tests/migrations/test_migrations_plan/0002_second.py index 12902ceec8..a0b8af6710 100644 --- a/tests/migrations/test_migrations_plan/0002_second.py +++ b/tests/migrations/test_migrations_plan/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/test_migrations_plan/0003_third.py b/tests/migrations/test_migrations_plan/0003_third.py index 1507fddb4c..7a5e341798 100644 --- a/tests/migrations/test_migrations_plan/0003_third.py +++ b/tests/migrations/test_migrations_plan/0003_third.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0002_second"), ] diff --git a/tests/migrations/test_migrations_plan/0004_fourth.py b/tests/migrations/test_migrations_plan/0004_fourth.py index 311e56c4b8..885d26a7d1 100644 --- a/tests/migrations/test_migrations_plan/0004_fourth.py +++ b/tests/migrations/test_migrations_plan/0004_fourth.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("migrations", "0003_third"), ] diff --git a/tests/migrations/test_migrations_run_before/0001_initial.py b/tests/migrations/test_migrations_run_before/0001_initial.py index 085f3347e8..8ff77e0fe6 100644 --- a/tests/migrations/test_migrations_run_before/0001_initial.py +++ b/tests/migrations/test_migrations_run_before/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Salamander", diff --git a/tests/migrations/test_migrations_run_before/0002_second.py b/tests/migrations/test_migrations_run_before/0002_second.py index 9e2784ae6c..0e0a9e81f6 100644 --- a/tests/migrations/test_migrations_run_before/0002_second.py +++ b/tests/migrations/test_migrations_run_before/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "0001_initial"), ] diff --git a/tests/migrations/test_migrations_squashed/0001_initial.py b/tests/migrations/test_migrations_squashed/0001_initial.py index 59ad944f67..42aadab7a0 100644 --- a/tests/migrations/test_migrations_squashed/0001_initial.py +++ b/tests/migrations/test_migrations_squashed/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_squashed/0001_squashed_0002.py b/tests/migrations/test_migrations_squashed/0001_squashed_0002.py index 4ac4530b02..8af697aedc 100644 --- a/tests/migrations/test_migrations_squashed/0001_squashed_0002.py +++ b/tests/migrations/test_migrations_squashed/0001_squashed_0002.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("migrations", "0001_initial"), ("migrations", "0002_second"), diff --git a/tests/migrations/test_migrations_squashed/0002_second.py b/tests/migrations/test_migrations_squashed/0002_second.py index 9b4c3264d6..55d3b9aaad 100644 --- a/tests/migrations/test_migrations_squashed/0002_second.py +++ b/tests/migrations/test_migrations_squashed/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("migrations", "0001_initial")] operations = [ diff --git a/tests/migrations/test_migrations_squashed_complex/1_auto.py b/tests/migrations/test_migrations_squashed_complex/1_auto.py index 56f45b2a62..2e5fb93b75 100644 --- a/tests/migrations/test_migrations_squashed_complex/1_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/1_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/2_auto.py b/tests/migrations/test_migrations_squashed_complex/2_auto.py index 379000e317..88678d4e59 100644 --- a/tests/migrations/test_migrations_squashed_complex/2_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/2_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "1_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/3_auto.py b/tests/migrations/test_migrations_squashed_complex/3_auto.py index e90bf593f9..b774a6cec5 100644 --- a/tests/migrations/test_migrations_squashed_complex/3_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/3_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "2_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/3_squashed_5.py b/tests/migrations/test_migrations_squashed_complex/3_squashed_5.py index f750d23b28..bf7fdaf718 100644 --- a/tests/migrations/test_migrations_squashed_complex/3_squashed_5.py +++ b/tests/migrations/test_migrations_squashed_complex/3_squashed_5.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("migrations", "3_auto"), ("migrations", "4_auto"), diff --git a/tests/migrations/test_migrations_squashed_complex/4_auto.py b/tests/migrations/test_migrations_squashed_complex/4_auto.py index 7bbe7b9614..a1f422a111 100644 --- a/tests/migrations/test_migrations_squashed_complex/4_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/4_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "3_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/5_auto.py b/tests/migrations/test_migrations_squashed_complex/5_auto.py index df5c2edf32..2b43fcf016 100644 --- a/tests/migrations/test_migrations_squashed_complex/5_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/5_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "4_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/6_auto.py b/tests/migrations/test_migrations_squashed_complex/6_auto.py index 0ce6bbbb45..52a06fb819 100644 --- a/tests/migrations/test_migrations_squashed_complex/6_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/6_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "5_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex/7_auto.py b/tests/migrations/test_migrations_squashed_complex/7_auto.py index 04d9ea4d55..7d995e208c 100644 --- a/tests/migrations/test_migrations_squashed_complex/7_auto.py +++ b/tests/migrations/test_migrations_squashed_complex/7_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "6_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/1_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/1_auto.py index 56f45b2a62..2e5fb93b75 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/1_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/1_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_auto.py index 7c01a498d2..606802b8c9 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "1_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_squashed_3.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_squashed_3.py index b9c26b89d3..71421b9fb6 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_squashed_3.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_squashed_3.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("app1", "2_auto"), ("app1", "3_auto"), diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/3_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/3_auto.py index 4ea2506733..33cffdbaf6 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/3_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/3_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "2_auto"), ("app2", "2_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/4_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/4_auto.py index 7752e23ea0..f584661820 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/4_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app1/4_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "3_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_auto.py index 7c01a498d2..606802b8c9 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "1_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_squashed_2.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_squashed_2.py index 0c182504db..0fbc0d7abb 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_squashed_2.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/1_squashed_2.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("app2", "1_auto"), ("app2", "2_auto"), diff --git a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/2_auto.py b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/2_auto.py index b87378ab49..9ddbf9ace5 100644 --- a/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/2_auto.py +++ b/tests/migrations/test_migrations_squashed_complex_multi_apps/app2/2_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app2", "1_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_erroneous/1_auto.py b/tests/migrations/test_migrations_squashed_erroneous/1_auto.py index 56f45b2a62..2e5fb93b75 100644 --- a/tests/migrations/test_migrations_squashed_erroneous/1_auto.py +++ b/tests/migrations/test_migrations_squashed_erroneous/1_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_erroneous/2_auto.py b/tests/migrations/test_migrations_squashed_erroneous/2_auto.py index 379000e317..88678d4e59 100644 --- a/tests/migrations/test_migrations_squashed_erroneous/2_auto.py +++ b/tests/migrations/test_migrations_squashed_erroneous/2_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "1_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_erroneous/3_squashed_5.py b/tests/migrations/test_migrations_squashed_erroneous/3_squashed_5.py index f750d23b28..bf7fdaf718 100644 --- a/tests/migrations/test_migrations_squashed_erroneous/3_squashed_5.py +++ b/tests/migrations/test_migrations_squashed_erroneous/3_squashed_5.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("migrations", "3_auto"), ("migrations", "4_auto"), diff --git a/tests/migrations/test_migrations_squashed_erroneous/6_auto.py b/tests/migrations/test_migrations_squashed_erroneous/6_auto.py index 0ce6bbbb45..52a06fb819 100644 --- a/tests/migrations/test_migrations_squashed_erroneous/6_auto.py +++ b/tests/migrations/test_migrations_squashed_erroneous/6_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "5_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_erroneous/7_auto.py b/tests/migrations/test_migrations_squashed_erroneous/7_auto.py index 04d9ea4d55..7d995e208c 100644 --- a/tests/migrations/test_migrations_squashed_erroneous/7_auto.py +++ b/tests/migrations/test_migrations_squashed_erroneous/7_auto.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("migrations", "6_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)] diff --git a/tests/migrations/test_migrations_squashed_no_replaces/0001_squashed_0002.py b/tests/migrations/test_migrations_squashed_no_replaces/0001_squashed_0002.py index 72eb931d32..a6049cade8 100644 --- a/tests/migrations/test_migrations_squashed_no_replaces/0001_squashed_0002.py +++ b/tests/migrations/test_migrations_squashed_no_replaces/0001_squashed_0002.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - operations = [ migrations.CreateModel( "Author", diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_auto.py b/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_auto.py index 27d00f0cba..087b76f190 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_auto.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "1_auto")] diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_squashed_3.py b/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_squashed_3.py index c036174132..c7101844b9 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_squashed_3.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app1/2_squashed_3.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("app1", "2_auto"), ("app1", "3_auto"), diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app1/3_auto.py b/tests/migrations/test_migrations_squashed_ref_squashed/app1/3_auto.py index 2203e4fdee..5b08c2be39 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app1/3_auto.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app1/3_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "2_auto"), ("app2", "2_auto")] diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app1/4_auto.py b/tests/migrations/test_migrations_squashed_ref_squashed/app1/4_auto.py index e9eddb1664..59f66bcd95 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app1/4_auto.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app1/4_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "2_squashed_3")] diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_auto.py b/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_auto.py index 27d00f0cba..087b76f190 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_auto.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app1", "1_auto")] diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_squashed_2.py b/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_squashed_2.py index ac24a30c85..7067239886 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_squashed_2.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app2/1_squashed_2.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - replaces = [ ("app2", "1_auto"), ("app2", "2_auto"), diff --git a/tests/migrations/test_migrations_squashed_ref_squashed/app2/2_auto.py b/tests/migrations/test_migrations_squashed_ref_squashed/app2/2_auto.py index 0b01988bbd..2937f3c74e 100644 --- a/tests/migrations/test_migrations_squashed_ref_squashed/app2/2_auto.py +++ b/tests/migrations/test_migrations_squashed_ref_squashed/app2/2_auto.py @@ -2,5 +2,4 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [("app2", "1_auto")] diff --git a/tests/migrations/test_migrations_unmigdep/0001_initial.py b/tests/migrations/test_migrations_unmigdep/0001_initial.py index 1cb4f8b06e..1ce1617611 100644 --- a/tests/migrations/test_migrations_unmigdep/0001_initial.py +++ b/tests/migrations/test_migrations_unmigdep/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("auth", "__first__"), ] diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 25f325246f..47465b1127 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -75,7 +75,6 @@ class StateTests(SimpleTestCase): indexes = [models.Index(fields=["title"])] class Food(models.Model): - food_mgr = FoodManager("a", "b") food_qs = FoodQuerySet.as_manager() food_no_mgr = NoMigrationFoodManager("x", "y") @@ -90,7 +89,6 @@ class StateTests(SimpleTestCase): apps = new_apps class FoodNoDefaultManager(models.Model): - food_no_mgr = NoMigrationFoodManager("x", "y") food_mgr = FoodManager("a", "b") food_qs = FoodQuerySet.as_manager() @@ -1816,7 +1814,6 @@ class ModelStateTests(SimpleTestCase): new_apps = Apps(["migrations"]) class Food(models.Model): - food_mgr = FoodManager("a", "b") food_qs = FoodQuerySet.as_manager() food_no_mgr = NoMigrationFoodManager("x", "y") diff --git a/tests/migrations2/test_migrations_2/0001_initial.py b/tests/migrations2/test_migrations_2/0001_initial.py index 812e8953be..4575f4d632 100644 --- a/tests/migrations2/test_migrations_2/0001_initial.py +++ b/tests/migrations2/test_migrations_2/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("migrations", "0002_second")] operations = [ diff --git a/tests/migrations2/test_migrations_2_first/0001_initial.py b/tests/migrations2/test_migrations_2_first/0001_initial.py index a4d690c7e4..98c197afa9 100644 --- a/tests/migrations2/test_migrations_2_first/0001_initial.py +++ b/tests/migrations2/test_migrations_2_first/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("migrations", "__first__"), ] diff --git a/tests/migrations2/test_migrations_2_first/0002_second.py b/tests/migrations2/test_migrations_2_first/0002_second.py index 8e85d6aae3..5ab497ed30 100644 --- a/tests/migrations2/test_migrations_2_first/0002_second.py +++ b/tests/migrations2/test_migrations_2_first/0002_second.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [("migrations2", "0001_initial")] operations = [ diff --git a/tests/migrations2/test_migrations_2_no_deps/0001_initial.py b/tests/migrations2/test_migrations_2_no_deps/0001_initial.py index d72c6c7a89..68f4bd07f7 100644 --- a/tests/migrations2/test_migrations_2_no_deps/0001_initial.py +++ b/tests/migrations2/test_migrations_2_no_deps/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index 647916e360..1e3abffb7d 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -214,6 +214,7 @@ class GenericIPAddress(models.Model): # These models aren't used in any test, just here to ensure they validate # successfully. + # See ticket #16570. class DecimalLessThanOne(models.Model): d = models.DecimalField(max_digits=3, decimal_places=3) diff --git a/tests/model_meta/models.py b/tests/model_meta/models.py index 684d655ad3..6da62be2ac 100644 --- a/tests/model_meta/models.py +++ b/tests/model_meta/models.py @@ -135,7 +135,6 @@ class PersonThroughProxySubclass(ProxyPerson): class Relating(models.Model): - # ForeignKey to BasePerson baseperson = models.ForeignKey( BasePerson, models.CASCADE, related_name="relating_baseperson" diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index c49a132f7c..c6b4a565c8 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -220,6 +220,7 @@ class ModelAdminTests(TestCase): conjunction with `ModelAdmin.readonly_fields` and when no `ModelAdmin.exclude` is defined (#14496). """ + # With ModelAdmin class AdminBandForm(forms.ModelForm): class Meta: @@ -284,6 +285,7 @@ class ModelAdminTests(TestCase): The custom ModelForm's `Meta.exclude` is overridden if `ModelAdmin.exclude` or `InlineModelAdmin.exclude` are defined (#14496). """ + # With ModelAdmin class AdminBandForm(forms.ModelForm): class Meta: diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index 7a9ff4da4e..323dbbc385 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -2240,7 +2240,6 @@ class SyncOnlyDefaultDatabaseRouter: class MigrateTestCase(TestCase): - # Limit memory usage when calling 'migrate'. available_apps = [ "multiple_database", diff --git a/tests/postgres_tests/array_default_migrations/0001_initial.py b/tests/postgres_tests/array_default_migrations/0001_initial.py index 10eaef2aab..5c6fa7e189 100644 --- a/tests/postgres_tests/array_default_migrations/0001_initial.py +++ b/tests/postgres_tests/array_default_migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py b/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py index b15b575e54..ab1f06b5de 100644 --- a/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py +++ b/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("postgres_tests", "0001_initial"), ] diff --git a/tests/postgres_tests/array_index_migrations/0001_initial.py b/tests/postgres_tests/array_index_migrations/0001_initial.py index 5c74be326a..d08243b67e 100644 --- a/tests/postgres_tests/array_index_migrations/0001_initial.py +++ b/tests/postgres_tests/array_index_migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/tests/postgres_tests/migrations/0001_setup_extensions.py b/tests/postgres_tests/migrations/0001_setup_extensions.py index 090abf9649..8045610aef 100644 --- a/tests/postgres_tests/migrations/0001_setup_extensions.py +++ b/tests/postgres_tests/migrations/0001_setup_extensions.py @@ -31,7 +31,6 @@ else: class Migration(migrations.Migration): - operations = [ BloomExtension(), BtreeGinExtension(), diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py index 1b05435494..64cd083236 100644 --- a/tests/postgres_tests/migrations/0002_create_test_models.py +++ b/tests/postgres_tests/migrations/0002_create_test_models.py @@ -18,7 +18,6 @@ from ..models import TagField class Migration(migrations.Migration): - dependencies = [ ("postgres_tests", "0001_setup_extensions"), ] diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 1100e8f3b0..a7b803659b 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -798,7 +798,6 @@ class TestChecks(PostgreSQLSimpleTestCase): @unittest.skipUnless(connection.vendor == "postgresql", "PostgreSQL specific tests") class TestMigrations(TransactionTestCase): - available_apps = ["postgres_tests"] def test_deconstruct(self): diff --git a/tests/postgres_tests/test_unaccent.py b/tests/postgres_tests/test_unaccent.py index 4188d90794..d7a8e7ed25 100644 --- a/tests/postgres_tests/test_unaccent.py +++ b/tests/postgres_tests/test_unaccent.py @@ -7,7 +7,6 @@ from .models import CharFieldModel, TextFieldModel @modify_settings(INSTALLED_APPS={"append": "django.contrib.postgres"}) class UnaccentTest(PostgreSQLTestCase): - Model = CharFieldModel @classmethod diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py index 7fef2b10d4..d06049898d 100644 --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -1726,7 +1726,9 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase): lookup. """ with self.assertNumQueries(3): - books = Book.objects.filter(title__in=["book1", "book2"],).prefetch_related( + books = Book.objects.filter( + title__in=["book1", "book2"], + ).prefetch_related( Prefetch( "first_time_authors", Author.objects.prefetch_related( @@ -1780,7 +1782,9 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase): def test_detect_is_fetched_with_to_attr(self): with self.assertNumQueries(3): - books = Book.objects.filter(title__in=["book1", "book2"],).prefetch_related( + books = Book.objects.filter( + title__in=["book1", "book2"], + ).prefetch_related( Prefetch( "first_time_authors", Author.objects.prefetch_related( diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 00213f0dfc..8df925c3d5 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -3280,7 +3280,9 @@ class ExcludeTests(TestCase): ) self.assertCountEqual( Job.objects.annotate( - responsibility=subquery.filter(job=OuterRef("name"),).values( + responsibility=subquery.filter( + job=OuterRef("name"), + ).values( "id" )[:1] ), diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 9c891c015e..e7c204d557 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -703,7 +703,6 @@ class SchemaTests(TransactionTestCase): """ class TestTransformField(IntegerField): - # Weird field that saves the count of items in its value def get_default(self): return self.default diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py index 5f5ada8939..4d697d7e24 100644 --- a/tests/select_for_update/tests.py +++ b/tests/select_for_update/tests.py @@ -33,7 +33,6 @@ from .models import ( class SelectForUpdateTests(TransactionTestCase): - available_apps = ["select_for_update"] def setUp(self): @@ -243,7 +242,9 @@ class SelectForUpdateTests(TransactionTestCase): def test_for_update_sql_model_proxy_generated_of(self): with transaction.atomic(), CaptureQueriesContext(connection) as ctx: list( - CityCountryProxy.objects.select_related("country",).select_for_update( + CityCountryProxy.objects.select_related( + "country", + ).select_for_update( of=("country",), ) ) @@ -422,7 +423,10 @@ class SelectForUpdateTests(TransactionTestCase): with self.subTest(name=name): with self.assertRaisesMessage(FieldError, msg % name): with transaction.atomic(): - Person.objects.select_related("born", "profile",).exclude( + Person.objects.select_related( + "born", + "profile", + ).exclude( profile=None ).select_for_update(of=(name,)).get() diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py index 330e5016e4..e1cb776d83 100644 --- a/tests/serializers/test_data.py +++ b/tests/serializers/test_data.py @@ -449,7 +449,7 @@ def serializerTest(self, format): # Create all the objects defined in the test data objects = [] instance_count = {} - for (func, pk, klass, datum) in test_data: + for func, pk, klass, datum in test_data: with connection.constraint_checks_disabled(): objects.extend(func[0](pk, klass, datum)) @@ -468,7 +468,7 @@ def serializerTest(self, format): # Assert that the deserialized data is the same # as the original source - for (func, pk, klass, datum) in test_data: + for func, pk, klass, datum in test_data: func[1](self, pk, klass, datum) # Assert that the number of objects deserialized is the diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py index 48899cb3fb..5467086cf1 100644 --- a/tests/serializers/tests.py +++ b/tests/serializers/tests.py @@ -436,7 +436,6 @@ class SerializerAPITests(SimpleTestCase): class SerializersTransactionTestBase: - available_apps = ["serializers"] @skipUnlessDBFeature("supports_forward_references") diff --git a/tests/servers/test_liveserverthread.py b/tests/servers/test_liveserverthread.py index 09b6ca08c8..8ed70f3202 100644 --- a/tests/servers/test_liveserverthread.py +++ b/tests/servers/test_liveserverthread.py @@ -7,7 +7,6 @@ from django.test.testcases import LiveServerThread # otherwise closing the connection would implicitly rollback and not set the # connection to None. class LiveServerThreadTest(TransactionTestCase): - available_apps = [] def run_live_server_thread(self, connections_override=None): diff --git a/tests/servers/tests.py b/tests/servers/tests.py index 47e7ceec16..9c014a3cec 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -29,7 +29,6 @@ TEST_SETTINGS = { @override_settings(ROOT_URLCONF="servers.urls", **TEST_SETTINGS) class LiveServerBase(LiveServerTestCase): - available_apps = [ "servers", "django.contrib.auth", @@ -55,7 +54,6 @@ class CloseConnectionTestServer(ThreadedWSGIServer): class CloseConnectionTestLiveServerThread(LiveServerThread): - server_class = CloseConnectionTestServer def _create_server(self, connections_override=None): @@ -63,7 +61,6 @@ class CloseConnectionTestLiveServerThread(LiveServerThread): class LiveServerTestCloseConnectionTest(LiveServerBase): - server_thread_class = CloseConnectionTestLiveServerThread @classmethod diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py index 96f8dbcd5b..74a6a6074d 100644 --- a/tests/sessions_tests/tests.py +++ b/tests/sessions_tests/tests.py @@ -390,7 +390,6 @@ class SessionTestsMixin: class DatabaseSessionTests(SessionTestsMixin, TestCase): - backend = DatabaseSession session_engine = "django.contrib.sessions.backends.db" @@ -501,7 +500,6 @@ class CustomDatabaseSessionTests(DatabaseSessionTests): class CacheDBSessionTests(SessionTestsMixin, TestCase): - backend = CacheDBSession def test_exists_searches_cache_first(self): @@ -528,7 +526,6 @@ class CacheDBSessionWithTimeZoneTests(CacheDBSessionTests): class FileSessionTests(SessionTestsMixin, SimpleTestCase): - backend = FileSession def setUp(self): @@ -624,7 +621,6 @@ class FileSessionPathLibTests(FileSessionTests): class CacheSessionTests(SessionTestsMixin, SimpleTestCase): - backend = CacheSession # Some backends might issue a warning @@ -867,7 +863,6 @@ class SessionMiddlewareTests(TestCase): class CookieSessionTests(SessionTestsMixin, SimpleTestCase): - backend = CookieSession def test_save(self): diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index f9ea7700bb..62cbffbee9 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -31,7 +31,6 @@ from django.utils.deprecation import RemovedInDjango50Warning ITEMS=["a", "c", "e"], ITEMS_OUTER=[1, 2, 3], TEST="override", TEST_OUTER="outer" ) class FullyDecoratedTranTestCase(TransactionTestCase): - available_apps = [] def test_override(self): diff --git a/tests/sites_framework/migrations/0001_initial.py b/tests/sites_framework/migrations/0001_initial.py index ba0cd36d48..c5721ee08e 100644 --- a/tests/sites_framework/migrations/0001_initial.py +++ b/tests/sites_framework/migrations/0001_initial.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("sites", "0001_initial"), ] diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py index 214459555d..714ebd1a8a 100644 --- a/tests/staticfiles_tests/test_liveserver.py +++ b/tests/staticfiles_tests/test_liveserver.py @@ -21,7 +21,6 @@ TEST_SETTINGS = { class LiveServerBase(StaticLiveServerTestCase): - available_apps = [] @classmethod diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index 3783d32872..0e7a8a0357 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -586,7 +586,6 @@ class CustomStaticFilesStorage(storage.StaticFilesStorage): @unittest.skipIf(sys.platform == "win32", "Windows only partially supports chmod.") class TestStaticFilePermissions(CollectionTestCase): - command_params = { "interactive": False, "verbosity": 0, diff --git a/tests/swappable_models/tests.py b/tests/swappable_models/tests.py index a2d043cb56..d2c28b20b1 100644 --- a/tests/swappable_models/tests.py +++ b/tests/swappable_models/tests.py @@ -7,7 +7,6 @@ from .models import Article class SwappableModelTests(TestCase): - # Limit memory usage when calling 'migrate'. available_apps = [ "swappable_models", diff --git a/tests/template_backends/test_django.py b/tests/template_backends/test_django.py index d91869a8c7..76f7a26db6 100644 --- a/tests/template_backends/test_django.py +++ b/tests/template_backends/test_django.py @@ -11,7 +11,6 @@ from .test_dummy import TemplateStringsTests class DjangoTemplatesTests(TemplateStringsTests): - engine_class = DjangoTemplates backend_name = "django" request_factory = RequestFactory() diff --git a/tests/template_backends/test_dummy.py b/tests/template_backends/test_dummy.py index adddbc6000..a8f5537334 100644 --- a/tests/template_backends/test_dummy.py +++ b/tests/template_backends/test_dummy.py @@ -14,7 +14,6 @@ from django.test import SimpleTestCase class TemplateStringsTests(SimpleTestCase): - engine_class = TemplateStrings backend_name = "dummy" options = {} diff --git a/tests/template_backends/test_jinja2.py b/tests/template_backends/test_jinja2.py index 8b282d43af..55c9299f85 100644 --- a/tests/template_backends/test_jinja2.py +++ b/tests/template_backends/test_jinja2.py @@ -17,7 +17,6 @@ else: @skipIf(jinja2 is None, "this test requires jinja2") class Jinja2Tests(TemplateStringsTests): - engine_class = Jinja2 backend_name = "jinja2" options = { diff --git a/tests/template_tests/filter_tests/test_timeuntil.py b/tests/template_tests/filter_tests/test_timeuntil.py index 1df5a24d15..d16ec1cfa9 100644 --- a/tests/template_tests/filter_tests/test_timeuntil.py +++ b/tests/template_tests/filter_tests/test_timeuntil.py @@ -9,7 +9,6 @@ from .timezone_utils import TimezoneTestCase class TimeuntilTests(TimezoneTestCase): - # Default compare with datetime.now() @setup({"timeuntil01": "{{ a|timeuntil }}"}) def test_timeuntil01(self): diff --git a/tests/template_tests/syntax_tests/i18n/test_underscore_syntax.py b/tests/template_tests/syntax_tests/i18n/test_underscore_syntax.py index ac6a22ed46..782ce015d8 100644 --- a/tests/template_tests/syntax_tests/i18n/test_underscore_syntax.py +++ b/tests/template_tests/syntax_tests/i18n/test_underscore_syntax.py @@ -83,7 +83,6 @@ class I18nStringLiteralTests(SimpleTestCase): @setup({"i18n13": '{{ _("Password") }}'}) def test_i18n13(self): - with translation.override("de"): output = self.engine.render_to_string("i18n13") self.assertEqual(output, "Passwort") diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py index a2f68d3512..eea9e4de74 100644 --- a/tests/test_runner/test_parallel.py +++ b/tests/test_runner/test_parallel.py @@ -41,7 +41,6 @@ class ParallelTestRunnerTest(SimpleTestCase): class SampleFailingSubtest(SimpleTestCase): - # This method name doesn't begin with "test" to prevent test discovery # from seeing it. def dummy_test(self): diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 30ea4ea670..8f174f3861 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -686,7 +686,6 @@ class NoInitializeSuiteTestRunnerTests(SimpleTestCase): class TestRunnerInitializerTests(SimpleTestCase): - # Raise an exception to don't actually run tests. @mock.patch.object( multiprocessing, "Pool", side_effect=Exception("multiprocessing.Pool()") diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index fb19d6e464..3b4ecdf6c0 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -70,6 +70,7 @@ class SkippingTestCase(SimpleTestCase): """ Testing the django.test.skipUnlessDBFeature decorator. """ + # Total hack, but it works, just want an attribute that's always true. @skipUnlessDBFeature("__class__") def test_func(): @@ -1988,7 +1989,6 @@ class SetupTestEnvironmentTests(SimpleTestCase): class OverrideSettingsTests(SimpleTestCase): - # #21518 -- If neither override_settings nor a setting_changed receiver # clears the URL cache between tests, then one of test_first or # test_second will fail. diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index f2617f4d0f..0f75005ec9 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -767,7 +767,6 @@ class ForcedTimeZoneDatabaseTests(TransactionTestCase): @override_settings(TIME_ZONE="Africa/Nairobi") class SerializationTests(SimpleTestCase): - # Backend-specific notes: # - JSON supports only milliseconds, microseconds will be truncated. # - PyYAML dumps the UTC offset correctly for timezone-aware datetimes. diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py index a528ab22e5..07b2dc9a72 100644 --- a/tests/transactions/tests.py +++ b/tests/transactions/tests.py @@ -303,7 +303,6 @@ class AtomicMergeTests(TransactionTestCase): @skipUnlessDBFeature("uses_savepoints") class AtomicErrorsTests(TransactionTestCase): - available_apps = ["transactions"] forbidden_atomic_msg = "This is forbidden when an 'atomic' block is active." @@ -373,7 +372,6 @@ class AtomicErrorsTests(TransactionTestCase): @skipUnlessDBFeature("uses_savepoints") @skipUnless(connection.vendor == "mysql", "MySQL-specific behaviors") class AtomicMySQLTests(TransactionTestCase): - available_apps = ["transactions"] @skipIf(threading is None, "Test requires threading") @@ -414,7 +412,6 @@ class AtomicMySQLTests(TransactionTestCase): class AtomicMiscTests(TransactionTestCase): - available_apps = ["transactions"] def test_wrap_callable_instance(self): @@ -434,13 +431,10 @@ class AtomicMiscTests(TransactionTestCase): # Expect an error when rolling back a savepoint that doesn't exist. # Done outside of the transaction block to ensure proper recovery. with self.assertRaises(Error): - # Start a plain transaction. with transaction.atomic(): - # Swallow the intentional error raised in the sub-transaction. with self.assertRaisesMessage(Exception, "Oops"): - # Start a sub-transaction with a savepoint. with transaction.atomic(): sid = connection.savepoint_ids[-1] @@ -451,14 +445,11 @@ class AtomicMiscTests(TransactionTestCase): def test_mark_for_rollback_on_error_in_transaction(self): with transaction.atomic(savepoint=False): - # Swallow the intentional error raised. with self.assertRaisesMessage(Exception, "Oops"): - # Wrap in `mark_for_rollback_on_error` to check if the # transaction is marked broken. with transaction.mark_for_rollback_on_error(): - # Ensure that we are still in a good state. self.assertFalse(transaction.get_rollback()) @@ -481,11 +472,9 @@ class AtomicMiscTests(TransactionTestCase): # Swallow the intentional error raised. with self.assertRaisesMessage(Exception, "Oops"): - # Wrap in `mark_for_rollback_on_error` to check if the transaction # is marked broken. with transaction.mark_for_rollback_on_error(): - # Ensure that we are still in a good state. self.assertFalse(transaction.get_connection().needs_rollback) @@ -500,7 +489,6 @@ class AtomicMiscTests(TransactionTestCase): class NonAutocommitTests(TransactionTestCase): - available_apps = [] def setUp(self): diff --git a/tests/unmanaged_models/models.py b/tests/unmanaged_models/models.py index 5262c15322..0eefcafda2 100644 --- a/tests/unmanaged_models/models.py +++ b/tests/unmanaged_models/models.py @@ -85,6 +85,7 @@ class Intermediate(models.Model): # models shouldn't be automatically created (see #10647). # + # Firstly, we need some models that will create the tables, purely so that the # tables are created. This is a test setup, not a requirement for unmanaged # models. diff --git a/tests/utils_tests/test_crypto.py b/tests/utils_tests/test_crypto.py index 3310e9231c..ed3ed25a9d 100644 --- a/tests/utils_tests/test_crypto.py +++ b/tests/utils_tests/test_crypto.py @@ -59,7 +59,6 @@ class TestUtilsCryptoMisc(SimpleTestCase): class TestUtilsCryptoPBKDF2(unittest.TestCase): - # https://tools.ietf.org/html/draft-josefsson-pbkdf2-test-vectors-06 rfc_vectors = [ { diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index 3aacded7c6..bba37022e7 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -487,7 +487,6 @@ class I18NViewTests(SimpleTestCase): @override_settings(ROOT_URLCONF="view_tests.urls") class I18nSeleniumTests(SeleniumTestCase): - # The test cases use fixtures & translations from these apps. available_apps = [ "django.contrib.admin",