From: Mike Bayer Date: Sat, 5 Nov 2022 14:26:36 +0000 (-0400) Subject: gc.collect() in order to ensure GeneratorExit raised on pypy X-Git-Tag: rel_1_4_44~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24c89a7c57484b48905800e5ffea2b6e1c7f3e47;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git gc.collect() in order to ensure GeneratorExit raised on pypy Fixes: #8762 Change-Id: Ibf656748ae6a54282ba58e91215e0f7a279b171a (cherry picked from commit 9febc1a53e4dbb363b1ead65bbe47e0c4f948bae) --- diff --git a/test/orm/test_query.py b/test/orm/test_query.py index a7fbf069ec..a249aa34bc 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -81,6 +81,7 @@ from sqlalchemy.testing.assertsql import CompiledSQL from sqlalchemy.testing.fixtures import fixture_session from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table +from sqlalchemy.testing.util import gc_collect from sqlalchemy.types import NullType from sqlalchemy.types import TypeDecorator from sqlalchemy.util import collections_abc @@ -5439,6 +5440,7 @@ class YieldTest(_fixtures.FixtureTest): if i > 1: raise Exception("hi") + gc_collect() # needed for pypy, #8762 assert asserted_result[0]._soft_closed assert not asserted_result[0].closed @@ -5460,6 +5462,7 @@ class YieldTest(_fixtures.FixtureTest): if i > 1: raise Exception("hi") + gc_collect() # not apparently needed, but defensive for pypy re: #8762 assert not result._soft_closed assert not result.closed result.close()