> *1) Checking database features*>In most cases, it is. But in some cases, you need to differentiate on severely
> This is the correct solution for database-dependant tests in general.
idiosyncratic behaviors, which defy attempts to define them as anything but
"behaves like MySql".
> *Would you object to adding "microsoft" to explicit checks for
> connection.vendor where appropriate?*
>
That seems ugly to me, unless we actually add a core backend for SQL Server.
It feels like adding a dependency on 3rd-party projects.
I suggest, instead, that we solve the problem for real (so even Firebird can
enjoy it): Remove all vendor checks except for positive checking. Replace
conditional code with either conditions on feature flags, or refactoring into
separate test functions; and replace negative checks by an API allowing the
backends to filter the tests. So, instead of a test saying "I'm not running on
Oracle", let Oracle say "I'm not running these tests".
Hi,
On Wednesday 07 May 2014 19:40:08 Aymeric Augustin wrote:
> *1) Checking database features*>In most cases, it is. But in some cases, you need to differentiate on severely
> This is the correct solution for database-dependant tests in general.
>
idiosyncratic behaviors, which defy attempts to define them as anything but
"behaves like MySql".
> *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*
>> *Would you object to adding "microsoft" to explicit checks for
> connection.vendor where appropriate?*
That seems ugly to me, unless we actually add a core backend for SQL Server.
It feels like adding a dependency on 3rd-party projects.
I suggest, instead, that we solve the problem for real (so even Firebird can
enjoy it): Remove all vendor checks except for positive checking.
Replace conditional code with either conditions on feature flags, or refactoring into
separate test functions;
and replace negative checks by an API allowing the
backends to filter the tests. So, instead of a test saying "I'm not running on
Oracle", let Oracle say "I'm not running these tests".
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 featuresThis 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.vendorThis 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?
--To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6b26dffd-d666-468d-b83b-b30f4c93eb38%40googlegroups.com.
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.