]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add the test_expire_lots test for comparison
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Feb 2015 20:50:37 +0000 (15:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Feb 2015 20:50:37 +0000 (15:50 -0500)
test/aaa_profiling/test_orm.py
test/profiles.txt

index 2e0cb4e44c3ea76e19590386a34df102097eab46..9251e75e1e078e9227f4490ecdc039235e1c7b1c 100644 (file)
@@ -407,3 +407,57 @@ class AttributeOverheadTest(fixtures.MappedTest):
             for child in children:
                 p1.children.remove(child)
         go()
+
+
+class SessionTest(fixtures.MappedTest):
+    @classmethod
+    def define_tables(cls, metadata):
+        Table(
+            'parent',
+            metadata,
+            Column('id', Integer,
+                   primary_key=True, test_needs_autoincrement=True),
+            Column('data', String(20)))
+        Table(
+            'child', metadata,
+            Column('id', Integer, primary_key=True,
+                   test_needs_autoincrement=True),
+            Column(
+                'data', String(20)), Column(
+                'parent_id', Integer, ForeignKey('parent.id'), nullable=False))
+
+    @classmethod
+    def setup_classes(cls):
+        class Parent(cls.Basic):
+            pass
+
+        class Child(cls.Basic):
+            pass
+
+    @classmethod
+    def setup_mappers(cls):
+        Child, Parent, parent, child = (cls.classes.Child,
+                                        cls.classes.Parent,
+                                        cls.tables.parent,
+                                        cls.tables.child)
+
+        mapper(
+            Parent, parent, properties={
+                'children': relationship(
+                    Child,
+                    backref='parent')})
+        mapper(Child, child)
+
+    def test_expire_lots(self):
+        Parent, Child = self.classes.Parent, self.classes.Child
+        obj = [Parent(
+            children=[Child() for j in range(10)]) for i in range(10)]
+
+        sess = Session()
+        sess.add_all(obj)
+        sess.flush()
+
+        @profiling.function_call_count()
+        def go():
+            sess.expire_all()
+        go()
index 0eb2add936f9f8168111015995820c094913bb13..6e55b647d02d756e9b7dfd35b392a30bdb0711d4 100644 (file)
@@ -231,6 +231,23 @@ test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_sqlite_pysqlite_noc
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.4_postgresql_psycopg2_cextensions 94,19
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.4_postgresql_psycopg2_nocextensions 94,19
 
+# TEST: test.aaa_profiling.test_orm.SessionTest.test_expire_lots
+
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_mysql_mysqldb_cextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_mysql_mysqldb_nocextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_postgresql_psycopg2_cextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_postgresql_psycopg2_nocextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_sqlite_pysqlite_cextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 2.7_sqlite_pysqlite_nocextensions 2481
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.3_postgresql_psycopg2_cextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.3_postgresql_psycopg2_nocextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.3_sqlite_pysqlite_cextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.3_sqlite_pysqlite_nocextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.4_postgresql_psycopg2_cextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.4_postgresql_psycopg2_nocextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.4_sqlite_pysqlite_cextensions 2482
+test.aaa_profiling.test_orm.SessionTest.test_expire_lots 3.4_sqlite_pysqlite_nocextensions 2482
+
 # TEST: test.aaa_profiling.test_pool.QueuePoolTest.test_first_connect
 
 test.aaa_profiling.test_pool.QueuePoolTest.test_first_connect 2.7_mysql_mysqldb_cextensions 91