From: Mike Bayer Date: Tue, 24 May 2022 16:27:59 +0000 (-0400) Subject: use random table name X-Git-Tag: rel_2_0_0b1~291 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b131d2dfc4c519b23d9ed29364036ef88b1863;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 --- diff --git a/test/dialect/mssql/test_reflection.py b/test/dialect/mssql/test_reflection.py index 7ee380477b..73fd6bf1ca 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 @@ -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))