]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
limit "no identity" test to a hardcoded dialect
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 Oct 2020 04:50:53 +0000 (00:50 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 7 Oct 2020 04:50:53 +0000 (00:50 -0400)
this test can't require "skip identity_columns" because
older Postgresql and Oracle report false for "identity_columns",
but their dialects won't skip actually rendering.

for now the only option is to hardcode to a non-identity
dialect.

Change-Id: Ia4f39f393b4ba10b3e82601a22ab75200cd52909

test/sql/test_identity_column.py

index 0b1bffd00052c73ddfef69d357495d9876dfd864..f99054d629c95cc509a32d22f0931ac921b5c917 100644 (file)
@@ -1,5 +1,3 @@
-import re
-
 from sqlalchemy import Column
 from sqlalchemy import Identity
 from sqlalchemy import Integer
@@ -153,6 +151,9 @@ class DefaultDialectIdentityDDL(_IdentityDDLFixture, fixtures.TestBase):
 
 
 class NotSupportingIdentityDDL(testing.AssertsCompiledSQL, fixtures.TestBase):
+    # a dialect that doesn't render IDENTITY
+    __dialect__ = "sqlite"
+
     @testing.skip_if(testing.requires.identity_columns)
     def test_identity_is_ignored(self):
         t = Table(
@@ -160,15 +161,8 @@ class NotSupportingIdentityDDL(testing.AssertsCompiledSQL, fixtures.TestBase):
             MetaData(),
             Column("foo", Integer(), Identity("always", start=3)),
         )
-        t2 = Table(
-            "foo_table",
-            MetaData(),
-            Column("foo", Integer()),
-        )
-        exp = CreateTable(t2).compile(dialect=testing.db.dialect)
         self.assert_compile(
-            CreateTable(t),
-            re.sub(r"[\n\t]", "", str(exp)),
+            CreateTable(t), "CREATE TABLE foo_table (foo INTEGER)"
         )