diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9a7c3620eb..5b799bcdd4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.10.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 4761144c7b..ed70f93628 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -982,7 +982,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) @@ -1106,6 +1106,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/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index b58af886de..ed86985cf8 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 f030b7fc1d..63e47aa130 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 d696639932..166563b200 100644 --- a/django/contrib/sitemaps/views.py +++ b/django/contrib/sitemaps/views.py @@ -47,7 +47,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) @@ -97,7 +96,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 16f3b4442c..c9cdc25566 100644 --- a/django/core/management/templates.py +++ b/django/core/management/templates.py @@ -158,7 +158,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 fa3bce2948..36048601af 100644 --- a/django/core/serializers/python.py +++ b/django/core/serializers/python.py @@ -128,8 +128,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 4ee73c0734..d2bc336dd8 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -269,6 +269,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 e61445e46c..65b8fb7f42 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -4,7 +4,6 @@ from django.db.models.constants import LOOKUP_SEP 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 ec5c9f4142..aca6d83962 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%(collation)s" sql_alter_column_null = "MODIFY %(column)s NULL" diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 9e24b186cf..3db3d6abd2 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -476,7 +476,6 @@ if is_psycopg3: return self.cursor.copy(statement) else: - Cursor = psycopg2.extensions.cursor class CursorDebugWrapper(BaseCursorDebugWrapper): diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index 2887071254..321fa530aa 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -5,7 +5,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 c9e924b182..89867b6623 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 71c1f2c7e8..f1acf98a8b 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 a243aba0b6..8847441a03 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 21a49bc229..2d8a5c5919 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -1106,7 +1106,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 04b3eb3473..7f8eb128e1 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -222,7 +222,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 ad1f15c426..b31fee7e89 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 @@ -541,7 +540,6 @@ class ForeignObject(RelatedField): swappable=True, **kwargs, ): - if rel is None: rel = self.rel_class( self, @@ -1616,7 +1614,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/options.py b/django/db/models/options.py index 607b19fb8a..be3d68f390 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -528,6 +528,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 f88662de12..9d621c4f69 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -2110,7 +2110,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 a53569c5a3..842b73e95c 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -482,7 +482,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 98abf7ddb5..ba561bba9f 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 031278c2e2..83cc136147 100644 --- a/django/template/backends/jinja2.py +++ b/django/template/backends/jinja2.py @@ -12,7 +12,6 @@ from .utils import csrf_input_lazy, csrf_token_lazy 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 66a08a8117..c699eb9264 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -270,7 +270,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 014d4ea464..fc14efee11 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -657,7 +657,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 ea63ac550e..6c4a5b005a 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -166,7 +166,6 @@ class _DatabaseFailure: class SimpleTestCase(unittest.TestCase): - # The class we'll use for the test client self.client. # Can be overridden in derived classes. client_class = Client @@ -652,7 +651,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") @@ -983,7 +981,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 d4574217f4..cf797d0279 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -78,7 +78,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 650247a7bb..735821d475 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 43c420d2fb..cf8b2d219c 100644 --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -41,7 +41,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 fe4d58f591..71ee232ae4 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. @wraps(view_func) diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py index 40ac58bc1d..92771c56df 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. @wraps(view_func) diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index bab988af23..a2db24fea1 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -1642,7 +1642,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 73f888d9d3..2d76509515 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -1492,7 +1492,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 51d0498ff7..c70adf2509 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -2376,7 +2376,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 86fb9740a5..03ab9a9454 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -5536,7 +5536,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 4948a60ee0..2fadbf9d8c 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -71,6 +71,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 @@ -335,7 +336,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( @@ -904,7 +904,6 @@ class RelatedFieldWidgetWrapperTests(SimpleTestCase): @override_settings(ROOT_URLCONF="admin_widgets.urls") class AdminWidgetSeleniumTestCase(AdminSeleniumTestCase): - available_apps = ["admin_widgets"] + AdminSeleniumTestCase.available_apps def setUp(self): @@ -1104,7 +1103,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/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 d923f5d60b..ea4399a44a 100644 --- a/tests/auth_tests/test_remote_user.py +++ b/tests/auth_tests/test_remote_user.py @@ -11,7 +11,6 @@ from django.test import Client, TestCase, modify_settings, override_settings @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 da6c53de48..b80294abca 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 c83cde60dd..88b514270a 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 5f11f91958..bfdf5ed4b4 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -247,7 +247,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, @@ -297,7 +296,6 @@ class EscapingChecksDebug(EscapingChecks): class BackendTestCase(TransactionTestCase): - available_apps = ["backends"] def create_squares_with_executemany(self, args): @@ -597,7 +595,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): @@ -753,7 +750,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 899f1af83f..ea9228376c 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -628,7 +628,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 a01dba46d0..fcce9579d4 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) @@ -704,6 +704,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): @@ -802,7 +803,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)) @@ -1149,7 +1149,6 @@ class BaseCacheTests: ) ) class DBCacheTests(BaseCacheTests, TransactionTestCase): - available_apps = ["cache"] def setUp(self): @@ -1468,7 +1467,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 3abd70ee0d..87e5453dbd 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -43,7 +43,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 7dccbf555d..173f767b28 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 deac1c2d77..78141b25b4 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -1167,7 +1167,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 2afea99b46..1fc7e94e0b 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -935,7 +935,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 733e40831c..3c06f07e06 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 459ea878de..276520f04d 100644 --- a/tests/forms_tests/field_tests/test_floatfield.py +++ b/tests/forms_tests/field_tests/test_floatfield.py @@ -133,7 +133,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 c3de4ae180..c3a3fb0e11 100644 --- a/tests/get_or_create/tests.py +++ b/tests/get_or_create/tests.py @@ -262,7 +262,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/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py index a4dc5eec75..3cecd70094 100644 --- a/tests/gis_tests/geoapp/tests.py +++ b/tests/gis_tests/geoapp/tests.py @@ -651,7 +651,7 @@ class GeoQuerySetTest(TestCase): self.assertEqual(len(line), ref_points.count()) # Compare pairs of manually sorted points, as the default ordering is # flaky. - for (point, ref_city) in zip(sorted(line), sorted(ref_points)): + for point, ref_city in zip(sorted(line), sorted(ref_points)): point_x, point_y = point self.assertAlmostEqual(point_x, ref_city.x, 5), self.assertAlmostEqual(point_y, ref_city.y, 5), diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index 9b6068009d..de2fcf5529 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 980887edfd..96826d3056 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 a611eb97a1..ab73596c4a 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 @@ -593,7 +592,6 @@ class BasicExtractorTests(ExtractorTests): class JavaScriptExtractorTests(ExtractorTests): - PO_FILE = "locale/%s/LC_MESSAGES/djangojs.po" % LOCALE def test_javascript_literals(self): @@ -706,7 +704,6 @@ class SymlinkExtractorTests(ExtractorTests): class CopyPluralFormsExtractorTests(ExtractorTests): - PO_FILE_ES = "locale/es/LC_MESSAGES/django.po" def test_copy_plural_forms(self): @@ -872,7 +869,6 @@ class LocationCommentsTests(ExtractorTests): class KeepPotFileExtractorTests(ExtractorTests): - POT_FILE = "locale/django.pot" def test_keep_pot_disabled_by_default(self): @@ -917,7 +913,6 @@ class MultipleLocaleExtractionTests(ExtractorTests): class ExcludedLocaleExtractionTests(ExtractorTests): - work_subdir = "exclude" LOCALES = ["en", "fr", "it"] @@ -972,7 +967,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 6f6f82bbcb..68827cb665 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 a283aa0769..139667a078 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -17,7 +17,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 c07c83d79d..ffc7579e10 100644 --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -747,6 +747,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 075bbaefbc..e539d4e6fb 100644 --- a/tests/invalid_models_tests/test_relative_fields.py +++ b/tests/invalid_models_tests/test_relative_fields.py @@ -1600,7 +1600,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/middleware/tests.py b/tests/middleware/tests.py index a1c4cba3dc..2153a0bb5a 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -37,7 +37,6 @@ def get_response_404(request): @override_settings(ROOT_URLCONF="middleware.urls") class CommonMiddlewareTest(SimpleTestCase): - rf = RequestFactory() @override_settings(APPEND_SLASH=True) @@ -390,7 +389,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 01b62dc3c0..71a93d3ad6 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 aad24eb6b0..55de9b3a67 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -79,7 +79,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") @@ -94,7 +93,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() @@ -1820,7 +1818,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 28ed59c391..c35dfc2ebe 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -212,6 +212,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 ab93bf5216..bdbe641cdf 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 a1d9a942d0..011a0d729b 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 feebbd6f59..f58c9477fc 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -864,7 +864,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 6d115773d4..4c0bca762b 100644 --- a/tests/postgres_tests/test_unaccent.py +++ b/tests/postgres_tests/test_unaccent.py @@ -5,7 +5,6 @@ from .models import CharFieldModel, TextFieldModel class UnaccentTest(PostgreSQLTestCase): - Model = CharFieldModel @classmethod diff --git a/tests/schema/tests.py b/tests/schema/tests.py index c0f0e52a63..bc603cb772 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -727,7 +727,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 97c067d76e..e8ba8f8b6e 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): 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 41997c98fb..67ae8f43de 100644 --- a/tests/serializers/tests.py +++ b/tests/serializers/tests.py @@ -461,7 +461,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 8796db9749..4dece98ce9 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -30,7 +30,6 @@ TEST_SETTINGS = { @override_settings(ROOT_URLCONF="servers.urls", **TEST_SETTINGS) class LiveServerBase(LiveServerTestCase): - available_apps = [ "servers", "django.contrib.auth", @@ -56,7 +55,6 @@ class CloseConnectionTestServer(ThreadedWSGIServer): class CloseConnectionTestLiveServerThread(LiveServerThread): - server_class = CloseConnectionTestServer def _create_server(self, connections_override=None): @@ -64,7 +62,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 d13c485342..ea2b201c20 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 @@ -880,7 +876,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 d6666537de..b2044878c9 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -24,7 +24,6 @@ from django.urls import clear_script_prefix, set_script_prefix 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 11b160945e..06df05e196 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -696,7 +696,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 fca430e93f..28145be3db 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -684,7 +684,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 be95f5ec03..25218299b2 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -68,6 +68,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(): @@ -1679,7 +1680,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 e3e2ea431e..433c921cd3 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -713,7 +713,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 1f2634224b..2419eb47f2 100644 --- a/tests/transactions/tests.py +++ b/tests/transactions/tests.py @@ -319,7 +319,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." @@ -392,7 +391,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") @@ -433,7 +431,6 @@ class AtomicMySQLTests(TransactionTestCase): class AtomicMiscTests(TransactionTestCase): - available_apps = ["transactions"] def test_wrap_callable_instance(self): @@ -453,13 +450,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] @@ -470,14 +464,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()) @@ -500,11 +491,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) @@ -519,7 +508,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 22c657c31e..e9f3e984b5 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -510,7 +510,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",