summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-04-27 09:49:07 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2023-04-27 09:51:14 -0400
commit6abb35d329aab9b8f27326d223cb9ac935c133e1 (patch)
tree0167f8b2c212fd6bea6f1afcff95555ceaa02012
parentd519bca7f953a0520cda79504dbc019e74e87b28 (diff)
downloadsqlalchemy-6abb35d329aab9b8f27326d223cb9ac935c133e1.tar.gz
use a lot more random names
very small number of tiny names generated by random_names() could cause _ordered_name_fixture() to run out of names. Fixes: #9706 Change-Id: I3df00c9cf99e76fe82eb535c7fe589b73b10cd67 (cherry picked from commit 1329037bfed428e458547824a861ce1aa9df0c78)
-rw-r--r--test/orm/test_inspect.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/orm/test_inspect.py b/test/orm/test_inspect.py
index 3cc7640cf..0ffc9e86e 100644
--- a/test/orm/test_inspect.py
+++ b/test/orm/test_inspect.py
@@ -440,14 +440,16 @@ class TestORMInspection(_fixtures.FixtureTest):
import random
import keyword
- names = {
- "".join(
- random.choice("abcdegfghijklmnopqrstuvwxyz")
- for i in range(random.randint(3, 15))
- )
- for j in range(random.randint(4, 12))
- }
- return list(names.difference(keyword.kwlist))
+ def _random_name():
+ while True:
+ name = "".join(
+ random.choice("abcdegfghijklmnopqrstuvwxyz")
+ for i in range(random.randint(5, 15))
+ )
+ if name not in keyword.kwlist:
+ return name
+
+ return [_random_name() for i in range(random.randint(8, 15))]
def _ordered_name_fixture(self, glbls, clsname, base, supercls):
import random