From: Mike Bayer Date: Tue, 24 May 2022 16:27:59 +0000 (-0400) Subject: use random table name X-Git-Tag: rel_1_4_37~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1a2247e71eb6298952ba9c0b65d4a796ad72dc4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git use random table name 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) --- diff --git a/test/dialect/mssql/test_reflection.py b/test/dialect/mssql/test_reflection.py index 781b4ef188..4c5a539816 100644 --- a/test/dialect/mssql/test_reflection.py +++ b/test/dialect/mssql/test_reflection.py @@ -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))