We should use test-skipping, not conditional discovery in runtests.py
|Patch needs improvement:
Currently the https://github.com/django/django/blob/master/tests/runtests.py#L62 get_test_modules function in
runtests.py has hardcoded skips in place for GIS and Postgres-specific tests. We should remove this logic from
runtests.py and instead ensure that the relevant tests use test-skipping appropriately. Reasons:
- Regardless of the discovery logic in
get_test_modules, you can always run any of these tests explicitly by providing the test label, and if you do so with the wrong database, the result should be skipped tests (with a reason for the skip which the test runner can output at the appropriate verbosity level), not failing tests (which could be quite confusing).
- The overall number of tests in Django's test suite (when no test labels are provided) should not vary depending on your settings, some tests should just be marked as skips. This makes it explicit to someone running the tests with a non-Postgres database (for instance) that there are a number of Postgres-specific tests which are being skipped for them, rather than silently hiding those tests entirely.