From: Jason Kirtland Date: Tue, 31 Mar 2009 21:35:44 +0000 (+0000) Subject: Special gc.collect() tickling for Jython patch from pjenvey X-Git-Tag: rel_0_6_6~241 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f94af4fda7979f0c24b42ccf2b68d6b16c06bb18;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Special gc.collect() tickling for Jython patch from pjenvey --- diff --git a/test/engine/pool.py b/test/engine/pool.py index fdac6c0d85..6f8013ae71 100644 --- a/test/engine/pool.py +++ b/test/engine/pool.py @@ -1,8 +1,8 @@ import testenv; testenv.configure_for_tests() -import threading, time, gc +import threading, time from sqlalchemy import pool, interfaces, create_engine import testlib.sa as tsa -from testlib import TestBase, testing +from testlib import TestBase, gc testing mcid = 1 diff --git a/test/engine/reconnect.py b/test/engine/reconnect.py index a1b08c6a39..e1d5744db5 100644 --- a/test/engine/reconnect.py +++ b/test/engine/reconnect.py @@ -2,9 +2,8 @@ import testenv; testenv.configure_for_tests() import weakref from testlib.sa import select, MetaData, Table, Column, Integer, String, pool import testlib.sa as tsa -from testlib import TestBase, testing, engines +from testlib import TestBase, testing, engines, gc import time -import gc class MockDisconnect(Exception): pass diff --git a/test/ext/associationproxy.py b/test/ext/associationproxy.py index 821ed90721..64683819bc 100644 --- a/test/ext/associationproxy.py +++ b/test/ext/associationproxy.py @@ -1,5 +1,4 @@ import testenv; testenv.configure_for_tests() -import gc from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm.collections import collection diff --git a/test/orm/_base.py b/test/orm/_base.py index 0a6ab81791..310c467912 100644 --- a/test/orm/_base.py +++ b/test/orm/_base.py @@ -1,4 +1,3 @@ -import gc import inspect import sys import types diff --git a/test/orm/attributes.py b/test/orm/attributes.py index 772e1bbd04..be8cbf714c 100644 --- a/test/orm/attributes.py +++ b/test/orm/attributes.py @@ -7,7 +7,6 @@ from sqlalchemy import exc as sa_exc from testlib import * from testlib.testing import eq_ from orm import _base -import gc # global for pickling tests MyTest = None diff --git a/test/orm/expire.py b/test/orm/expire.py index c11fb69dfe..bbc011f875 100644 --- a/test/orm/expire.py +++ b/test/orm/expire.py @@ -1,8 +1,7 @@ """Attribute/instance expiration, deferral of attributes, etc.""" import testenv; testenv.configure_for_tests() -import gc -from testlib import sa, testing +from testlib import gc, sa, testing from testlib.sa import Table, Column, Integer, String, ForeignKey, exc as sa_exc from testlib.sa.orm import mapper, relation, create_session, attributes, deferred from orm import _base, _fixtures diff --git a/test/orm/query.py b/test/orm/query.py index f79a3b19b4..0d89303113 100644 --- a/test/orm/query.py +++ b/test/orm/query.py @@ -1008,7 +1008,6 @@ class DistinctTest(QueryTest): class YieldTest(QueryTest): def test_basic(self): - import gc sess = create_session() q = iter(sess.query(User).yield_per(1).from_statement("select * from users")) diff --git a/test/orm/session.py b/test/orm/session.py index 818ab03daf..dc5bf25784 100644 --- a/test/orm/session.py +++ b/test/orm/session.py @@ -1,9 +1,8 @@ import testenv; testenv.configure_for_tests() -import gc import inspect import pickle from sqlalchemy.orm import create_session, sessionmaker, attributes -from testlib import engines, sa, testing, config +from testlib import engines, gc, sa, testing, config from testlib.sa import Table, Column, Integer, String, Sequence from testlib.sa.orm import mapper, relation, backref from testlib.testing import eq_ @@ -788,7 +787,6 @@ class SessionTest(_fixtures.FixtureTest): user = s.query(User).one() user = None print s.identity_map - import gc gc.collect() assert len(s.identity_map) == 1 @@ -812,7 +810,6 @@ class SessionTest(_fixtures.FixtureTest): self.assert_(len(s.identity_map) == 0) self.assert_(s.prune() == 0) s.flush() - import gc gc.collect() self.assert_(s.prune() == 9) self.assert_(len(s.identity_map) == 1) diff --git a/test/orm/transaction.py b/test/orm/transaction.py index cad303a0c5..444a851dd1 100644 --- a/test/orm/transaction.py +++ b/test/orm/transaction.py @@ -6,7 +6,6 @@ from sqlalchemy import exc as sa_exc from sqlalchemy.orm import * from testlib import * from testlib.fixtures import * -import gc class TransactionTest(FixtureTest): keep_mappers = True diff --git a/test/perf/masscreate.py b/test/perf/masscreate.py index ae32f83e2c..10f6514f0e 100644 --- a/test/perf/masscreate.py +++ b/test/perf/masscreate.py @@ -2,8 +2,8 @@ import testenv; testenv.simple_setup() from sqlalchemy.orm import attributes +from testlib import gc import time -import gc manage_attributes = True init_attributes = manage_attributes and True diff --git a/test/perf/masscreate2.py b/test/perf/masscreate2.py index 25d4b49153..88a4d3c17e 100644 --- a/test/perf/masscreate2.py +++ b/test/perf/masscreate2.py @@ -1,9 +1,9 @@ import testenv; testenv.simple_setup() -import gc import random, string from sqlalchemy.orm import attributes +from testlib import gc # with this test, run top. make sure the Python process doenst grow in size arbitrarily. diff --git a/test/perf/massload.py b/test/perf/massload.py index 9391ead2a5..4e2b05d123 100644 --- a/test/perf/massload.py +++ b/test/perf/massload.py @@ -1,6 +1,5 @@ import testenv; testenv.configure_for_tests() import time -#import gc #import sqlalchemy.orm.attributes as attributes from sqlalchemy import * from sqlalchemy.orm import * diff --git a/test/perf/objselectspeed.py b/test/perf/objselectspeed.py index 896fd4c494..788bdcd46b 100644 --- a/test/perf/objselectspeed.py +++ b/test/perf/objselectspeed.py @@ -1,7 +1,8 @@ import testenv; testenv.simple_setup() -import time, gc, resource +import time, resource from sqlalchemy import * from sqlalchemy.orm import * +from testlib import gc db = create_engine('sqlite://') diff --git a/test/perf/objupdatespeed.py b/test/perf/objupdatespeed.py index a49eb47245..a6ed83a07d 100644 --- a/test/perf/objupdatespeed.py +++ b/test/perf/objupdatespeed.py @@ -1,5 +1,5 @@ import testenv; testenv.configure_for_tests() -import time, gc, resource +import time, resource from sqlalchemy import * from sqlalchemy.orm import * from testlib import * diff --git a/test/perf/sessions.py b/test/perf/sessions.py index c5f7686531..9d0e480f89 100644 --- a/test/perf/sessions.py +++ b/test/perf/sessions.py @@ -3,7 +3,6 @@ from sqlalchemy import * from sqlalchemy.orm import * from testlib import * from testlib import fixtures -import gc # in this test we are specifically looking for time spent in the attributes.InstanceState.__cleanup() method. diff --git a/test/profiling/memusage.py b/test/profiling/memusage.py index 4f65f1d33c..fb5df227d6 100644 --- a/test/profiling/memusage.py +++ b/test/profiling/memusage.py @@ -1,10 +1,9 @@ import testenv; testenv.configure_for_tests() -import gc from sqlalchemy.orm import mapper, relation, create_session, clear_mappers, sessionmaker from sqlalchemy.orm.mapper import _mapper_registry from sqlalchemy.orm.session import _sessions import operator -from testlib import testing +from testlib import gc, testing from testlib.sa import MetaData, Table, Column, Integer, String, ForeignKey, PickleType import sqlalchemy as sa from sqlalchemy.sql import column diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py index 5dea60322b..3996364a07 100644 --- a/test/testlib/__init__.py +++ b/test/testlib/__init__.py @@ -17,6 +17,7 @@ from testlib.testing import \ from testlib.orm import mapper import testlib.profiling as profiling import testlib.engines as engines +import testlib.sa_gc as gc import testlib.requires as requires from testlib.compat import _function_named @@ -27,7 +28,7 @@ __all__ = ('testing', 'rowset', 'TestBase', 'AssertsExecutionResults', 'ORMTest', 'AssertsCompiledSQL', 'ComparesTables', - 'profiling', 'engines', + 'profiling', 'engines', 'gc', '_function_named')