Hello,

I'm trying to make the lives of maintainers of third-party database
backends a bit easier.

I'm specifically interested in MSSQL backends. Unlike Oracle, it isn't
supported by Django out of the box, but it's a very common database. The
most robust implementation, django-mssql, is very close to passing Django's
entire test suite in addition to its own test suite.

Currrently Django uses two solutions for database-dependant tests, both of
which would require small adjustments to support third-party backends
adequately.

*1) Checking database features*

This is the correct solution for database-dependant tests in general.

*What do you think of adding feature flags that have the same value for all
core backends but may be set to a different value by third-party backends?*

With a comment explaining which backends use the flag and what it does, I
find it acceptable. Then we would skip some tests based on the flag.

*2) Checking connection.vendor*

This is often inferior to feature flags.

Positive checking ("run this test only for SQLite") is reasonable. At
worst, the test is skipped on third-party databases where it could pass.

Negative checking ("run this test on all databases except Oracle") is more
problematic. If a third-party backend also fails the test, there's no easy
way to ignore it.

Conditional code ("do X for vendors A, B and C, do Y for other vendors") is
also problematic. All third-party backends will do Y, which may or may not
be the right behaviour.

*Would you object to adding "microsoft" to explicit checks for
connection.vendor where appropriate?*

For an example, see
https://github.com/manfre/django/commit/8a9c31caaac30b1462481ecdb028f31c4db44375

Of cours, if that becomes too complicated to manage, that means we should
switch to a feature flag ;-)

Thanks for your feedback,

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CANE-7mVLHSpC3ZVBacBs_u0-rLDUogYFjtcy2FY3q_--kPes2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to