﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32178	Allow database backends to skip tests and mark expected failures	Tim Graham	Hasan Ramezani	"Currently Django's built-in database backends have special privileges in the test suite when it comes to test skipping such as:
`tests/model_fields/test_integerfield.py:    @unittest.skipIf(connection.vendor == 'sqlite', ""SQLite doesn't have a constraint."")`

While `DatabaseFeatures` attributes are generally preferred to `connection.vendor` checking, I think allowing backends to skip certain tests has its place. Adding features flags that are likely to apply to only a single database is a bit cumbersome, especially for third-party backends.

Django should provide more generic way to skip tests and mark expected failures. For example, see [https://github.com/cockroachdb/django-cockroachdb/blob/6304e41fc5725fcfe53b851498529c339ba89f20/django_cockroachdb/creation.py#L17-L214 django-cockroachdb's logic] which was inspired by [https://bitbucket.org/Manfre/django-mssql/src/master/sqlserver_ado/creation.py django-mssql-backend]. In a more refined version, `expected_failures` and `skip_classes` would be attributes of `DatabaseFeatures`.

That logic uses a `RUNNING_COCKROACH_BACKEND_TESTS` environment variable to decide whether or not the Django test suite is running. There might be a better way to determine that. At least the variable name would be more generic."	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
