diff options
| author | Simon Charette <charette.s@gmail.com> | 2019-01-12 16:14:54 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-01-14 16:16:30 -0500 |
| commit | b181aba7dd24c73ec9923c39e35393b0487a5f47 (patch) | |
| tree | e5d82ea665a4b6eace3e07fb53d78808b936c624 /tests/backends/base | |
| parent | f5b635086a07c9df5897e69685ebdc3a04049ec6 (diff) | |
Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
Database features may require a connection to be established to determine
whether or not they are enabled.
Diffstat (limited to 'tests/backends/base')
| -rw-r--r-- | tests/backends/base/test_operations.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/backends/base/test_operations.py b/tests/backends/base/test_operations.py index 7ca0535135..607afb6dfc 100644 --- a/tests/backends/base/test_operations.py +++ b/tests/backends/base/test_operations.py @@ -15,12 +15,6 @@ class SimpleDatabaseOperationTests(SimpleTestCase): def setUp(self): self.ops = BaseDatabaseOperations(connection=connection) - @skipIfDBFeature('can_distinct_on_fields') - def test_distinct_on_fields(self): - msg = 'DISTINCT ON fields is not supported by this database backend' - with self.assertRaisesMessage(NotSupportedError, msg): - self.ops.distinct_sql(['a', 'b'], None) - def test_deferrable_sql(self): self.assertEqual(self.ops.deferrable_sql(), '') @@ -123,6 +117,23 @@ class SimpleDatabaseOperationTests(SimpleTestCase): with self.assertRaisesMessage(NotImplementedError, self.may_requre_msg % 'datetime_extract_sql'): self.ops.datetime_extract_sql(None, None, None) + +class DatabaseOperationTests(TestCase): + def setUp(self): + self.ops = BaseDatabaseOperations(connection=connection) + + @skipIfDBFeature('supports_over_clause') + def test_window_frame_raise_not_supported_error(self): + msg = 'This backend does not support window expressions.' + with self.assertRaisesMessage(NotSupportedError, msg): + self.ops.window_frame_rows_start_end() + + @skipIfDBFeature('can_distinct_on_fields') + def test_distinct_on_fields(self): + msg = 'DISTINCT ON fields is not supported by this database backend' + with self.assertRaisesMessage(NotSupportedError, msg): + self.ops.distinct_sql(['a', 'b'], None) + @skipIfDBFeature('supports_temporal_subtraction') def test_subtract_temporals(self): duration_field = DurationField() @@ -133,13 +144,3 @@ class SimpleDatabaseOperationTests(SimpleTestCase): ) with self.assertRaisesMessage(NotSupportedError, msg): self.ops.subtract_temporals(duration_field_internal_type, None, None) - - -class DatabaseOperationTests(TestCase): - # Checking the 'supports_over_clause' feature requires a query for the - # MySQL backend to perform a version check. - @skipIfDBFeature('supports_over_clause') - def test_window_frame_raise_not_supported_error(self): - msg = 'This backend does not support window expressions.' - with self.assertRaisesMessage(NotSupportedError, msg): - connection.ops.window_frame_rows_start_end() |
