Hi,
I have been looking into the testing within Django’s test suite with regards to tests that are skipped depending upon the features supported by a given database provider.
Django natively supports Postgres, MariaDB, MySQL, Oracle, and SQLite. The features are listed and their support is declared within the appropriate DB vendor’s features.py
module. There are some features that are inherited from a base class. Overall, it seems there are 145 features used within the @skipUnlessDBFeature(<db_feature_name>)
decorators.
When deciding upon which features were supported, I imagine this was a painstaking discovery exercise in researching the support for the features. Does anyone know how was this approached?
The reason I am asking is because I have been looking at mssql-django which is the package provided by Microsoft to provide support for SQL Server as a backend for Django. Their features list does not seem complete when compared against the unique features list within Django 5.2. It probably needs some time spent on updating it.
Are these literally researched ad-hoc and feature-by-feature; or by miracle, is there some all encompassing list out there for this? I have had a look and think I know the answer to this but I ask in hope more than expectation. 
Thanks,
Wayne
Every time a new feature is added, we add it to the base backend and ensure it is correctly set for all built-in backends. Yes, it takes painstaking research.
See the commits that affect the base backend’s features to see some examples: History for django/db/backends/base/features.py - django/django · GitHub
Yes, it probably does. I see they only claim to support up to Django 5.0, so that’s changes from 5.1 and 5.2 they need to respond to.
To aid database backend maintainers, the changelogs for each release announce the major changes, for example here for Django 5.2. Hopefully, those release notes help you.
Do you work at Microsoft?
Thanks @adamchainz , I appreciate you taking the time to answer and providing some links to look through. I will browse through them to see if I can find inspiration as to where to find this detail. I was just hoping there was going to be some sort of resource which declares support for those features for the various providers.
No, I don’t work at Microsoft. Our company just uses the mssql-django adapter and it not being updated is proving to be the bottleneck in updating Django to a more recent version. Since the official word from a maintainer at Microsoft is that they won’t be able to address the changes for compatibility until Q3 at the earliest, I cloned the repository to do an analysis on the effort required to support Django 5.1, and then 5.2.
When I ran the suite against 5.1, a few code changes were required as well as excluding some tests with rationale or for known reasons was enough to get all of the tests to pass.
When I ran the suite against 5.2, there were significantly more failures that needed addressing. It seemed like the number of tests in 5.2 had increased somewhat and on reviewing the list of supported features in mssql-django, it seemed out of date and perhaps that more tests were being ran than is actually required to support the features that the package declares support for.
That sucks! If only they had billions of dollars.
Yeah, custom backends often need to exclude tests.
Django has a “feature” for that, added in Fixed #32178 -- Allowed database backends to skip tests and mark expe… · django/django@275dd4e · GitHub
It looks like mssql-django does it with a custom test runner though: mssql-django/testapp/settings.py at dev · microsoft/mssql-django · GitHub
Yes, I often think it be great if the likes of Microsoft and Oracle were able to generously sponsor Django for native DB support either through funds or development resources.
Thanks. I appreciate the additional links. I’ll check them out.