]> 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:27:59 +0000 (12:27 -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

test/dialect/mssql/test_reflection.py

index 7ee380477bda07649670c0a2774c63836e33eb37..73fd6bf1caa277368346f8f94f4846350596970c 100644 (file)
@@ -1,6 +1,7 @@
 # -*- encoding: utf-8
 import datetime
 import decimal
+import random
 
 from sqlalchemy import Column
 from sqlalchemy import DDL
@@ -387,12 +388,14 @@ class ReflectionTest(fixtures.TestBase, ComparesTables, AssertsCompiledSQL):
     ):
         """test #8035"""
 
+        tname = f"##foo{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(f"CREATE TABLE {tname} (id int primary key)")
             conn.commit()
 
             eq_(
-                inspect(conn).get_columns("##foo"),
+                inspect(conn).get_columns(tname),
                 [
                     {
                         "name": "id",
@@ -403,7 +406,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))