]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Apply fix to ComputedReflectionFixtureTest
authorGord Thompson <gord@gordthompson.com>
Sat, 4 Apr 2020 19:39:50 +0000 (13:39 -0600)
committerGord Thompson <gord@gordthompson.com>
Sun, 5 Apr 2020 12:43:38 +0000 (06:43 -0600)
Avoid errors for dialects without schema support.
Also fix typo in test name.

Fixes: #5230
Change-Id: Id0f759b591a6119069b0fc5fc3b02addb85b0597
(cherry picked from commit 50f1e1392a92f31f1f2d5110e6632bc5a32467e7)

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

index 384fc9165f5a8ec818b172cf6aca5d9473619c8f..946b885d734326d283f364039d922b1c2cb806c0 100644 (file)
@@ -437,14 +437,16 @@ class ComputedReflectionFixtureTest(TablesTest):
             Column("computed_no_flag", Integer, Computed("normal + 42")),
         )
 
-        t2 = Table(
-            "computed_column_table",
-            metadata,
-            Column("id", Integer, primary_key=True),
-            Column("normal", Integer),
-            Column("computed_no_flag", Integer, Computed("normal / 42")),
-            schema=config.test_schema,
-        )
+        if testing.requires.schemas.enabled:
+            t2 = Table(
+                "computed_column_table",
+                metadata,
+                Column("id", Integer, primary_key=True),
+                Column("normal", Integer),
+                Column("computed_no_flag", Integer, Computed("normal / 42")),
+                schema=config.test_schema,
+            )
+
         if testing.requires.computed_columns_virtual.enabled:
             t.append_column(
                 Column(
@@ -453,13 +455,14 @@ class ComputedReflectionFixtureTest(TablesTest):
                     Computed("normal + 2", persisted=False),
                 )
             )
-            t2.append_column(
-                Column(
-                    "computed_virtual",
-                    Integer,
-                    Computed("normal / 2", persisted=False),
+            if testing.requires.schemas.enabled:
+                t2.append_column(
+                    Column(
+                        "computed_virtual",
+                        Integer,
+                        Computed("normal / 2", persisted=False),
+                    )
                 )
-            )
         if testing.requires.computed_columns_stored.enabled:
             t.append_column(
                 Column(
@@ -468,10 +471,11 @@ class ComputedReflectionFixtureTest(TablesTest):
                     Computed("normal - 42", persisted=True),
                 )
             )
-            t2.append_column(
-                Column(
-                    "computed_stored",
-                    Integer,
-                    Computed("normal * 42", persisted=True),
+            if testing.requires.schemas.enabled:
+                t2.append_column(
+                    Column(
+                        "computed_stored",
+                        Integer,
+                        Computed("normal * 42", persisted=True),
+                    )
                 )
-            )
index 1f19bcc2a9bed3be9101ea593736d6343772ea37..ce19c4aeddf780a4bb31dc82cf6fbfd6aa07954c 100644 (file)
@@ -1166,7 +1166,8 @@ class ComputedReflectionTest(fixtures.ComputedReflectionFixtureTest):
                 data, "computed_stored", "normal-42", True,
             )
 
-    def test_get_column_returns_persisted_with_schama(self):
+    @testing.requires.schemas
+    def test_get_column_returns_persisted_with_schema(self):
         insp = inspect(config.db)
 
         cols = insp.get_columns(