]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
use random table name
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 May 2022 16:27:59 +0000 (12:27 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 May 2022 16:29:31 +0000 (12:29 -0400)
this test is failing on CI with "##foo does not exist",
so hypothesize there's some kind of race condition with
global temp table names.

Change-Id: I8c6c26a7fda70f67735ce20af67373c311e48731
(cherry picked from commit d7b131d2dfc4c519b23d9ed29364036ef88b1863)

test/dialect/mssql/test_reflection.py

index 781b4ef188f4e79394b6901d41095e65c3591609..4c5a5398164ae46357ff104499a4d0c2a53be437 100644 (file)
@@ -1,6 +1,7 @@
 # -*- encoding: utf-8
 import datetime
 import decimal
+import random
 
 from sqlalchemy import Column
 from sqlalchemy import DDL
@@ -388,12 +389,16 @@ class ReflectionTest(fixtures.TestBase, ComparesTables, AssertsCompiledSQL):
     ):
         """test #8035"""
 
+        tname = "##foo%s" % (random.randint(1, 1000000),)
+
         with temp_db_alt_collation_fixture.connect() as conn:
-            conn.exec_driver_sql("CREATE TABLE ##foo (id int primary key)")
+            conn.exec_driver_sql(
+                "CREATE TABLE %s (id int primary key)" % (tname,)
+            )
             conn.commit()
 
             eq_(
-                inspect(conn).get_columns("##foo"),
+                inspect(conn).get_columns(tname),
                 [
                     {
                         "name": "id",
@@ -404,7 +409,7 @@ class ReflectionTest(fixtures.TestBase, ComparesTables, AssertsCompiledSQL):
                     }
                 ],
             )
-            Table("##foo", MetaData(), autoload_with=conn)
+            Table(tname, MetaData(), autoload_with=conn)
 
     def test_db_qualified_items(self, metadata, connection):
         Table("foo", metadata, Column("id", Integer, primary_key=True))