]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add test requirement: indexes_with_ascdesc
authorGord Thompson <gord@gordthompson.com>
Mon, 20 Jan 2020 20:21:17 +0000 (15:21 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Jan 2020 00:30:41 +0000 (19:30 -0500)
There are some tests for indexes that include DESC in the
columns.  Firebird and maybe others don't support this concept,
so put it under a requirement rule.

Fixes: #5106
Closes: #5108
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5108
Pull-request-sha: 4b1560f28a52feb7d4a6c5d828f587a735d6a40b

Change-Id: I4744246005f3af263ea1e028d8a46795b87de62c
(cherry picked from commit 9e3977738c7c698442cb88f4201f995d8901a45f)

lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_reflection.py

index 3bf608e1e9f28487cff0e74df21f325ca15a5773..301839eb386ec465585c73eb2ae505dd73a9eac8 100644 (file)
@@ -493,6 +493,11 @@ class SuiteRequirements(Requirements):
     def index_reflection(self):
         return exclusions.open()
 
+    @property
+    def indexes_with_ascdesc(self):
+        """target database supports CREATE INDEX with per-column ASC/DESC."""
+        return exclusions.open()
+
     @property
     def indexes_with_expressions(self):
         """target database supports CREATE INDEX against SQL expressions."""
index a1297a5804747645794c6f190c8e6c9f8ce8dc10..a5302cfd208533636d1cdcd761864c8424c4201f 100644 (file)
@@ -233,8 +233,10 @@ class ComponentReflectionTest(fixtures.TablesTest):
                     Column("q", sa.String(5)),
                     test_needs_fk=True,
                 )
-                Index("noncol_idx_nopk", noncol_idx_test_nopk.c.q.desc())
-                Index("noncol_idx_pk", noncol_idx_test_pk.c.q.desc())
+
+                if testing.requires.indexes_with_ascdesc.enabled:
+                    Index("noncol_idx_nopk", noncol_idx_test_nopk.c.q.desc())
+                    Index("noncol_idx_pk", noncol_idx_test_pk.c.q.desc())
 
         if testing.requires.view_column_reflection.enabled:
             cls.define_views(metadata, schema)
@@ -803,10 +805,12 @@ class ComponentReflectionTest(fixtures.TablesTest):
         eq_(list(t.indexes)[0].name, ixname)
 
     @testing.requires.index_reflection
+    @testing.requires.indexes_with_ascdesc
     def test_get_noncol_index_no_pk(self):
         self._test_get_noncol_index("noncol_idx_test_nopk", "noncol_idx_nopk")
 
     @testing.requires.index_reflection
+    @testing.requires.indexes_with_ascdesc
     def test_get_noncol_index_pk(self):
         self._test_get_noncol_index("noncol_idx_test_pk", "noncol_idx_pk")