diff options
Diffstat (limited to 'test/aaa_profiling')
| -rw-r--r-- | test/aaa_profiling/test_memusage.py | 4 | ||||
| -rw-r--r-- | test/aaa_profiling/test_orm.py | 60 | ||||
| -rw-r--r-- | test/aaa_profiling/test_resultset.py | 1 | ||||
| -rw-r--r-- | test/aaa_profiling/test_zoomark.py | 1 | ||||
| -rw-r--r-- | test/aaa_profiling/test_zoomark_orm.py | 1 |
5 files changed, 64 insertions, 3 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 20c6f0a65..3766abb88 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -47,6 +47,7 @@ def profile_memory(times=50): gc_collect() samples[x] = len(get_objects_skipping_sqlite_issue()) + print("sample gc sizes:", samples) assert len(_sessions) == 0 @@ -307,7 +308,7 @@ class MemUsageTest(EnsureZeroed): finally: metadata.drop_all() - @testing.crashes('mysql+cymysql', 'blocking with cymysql >= 0.6') + @testing.crashes('mysql+cymysql', 'blocking') def test_unicode_warnings(self): metadata = MetaData(testing.db) table1 = Table('mytable', metadata, Column('col1', Integer, @@ -603,6 +604,7 @@ class MemUsageTest(EnsureZeroed): # in pysqlite itself. background at: # http://thread.gmane.org/gmane.comp.python.db.pysqlite.user/2290 + @testing.crashes('mysql+cymysql', 'blocking') def test_join_cache(self): metadata = MetaData(testing.db) table1 = Table('table1', metadata, Column('id', Integer, diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 6d71468b7..2c1e84afb 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -310,3 +310,63 @@ class DeferOptionsTest(fixtures.MappedTest): *[defer(letter) for letter in ['x', 'y', 'z', 'p', 'q', 'r']]).\ all() + +class AttributeOverheadTest(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_attribute_set(self): + Parent, Child = self.classes.Parent, self.classes.Child + p1 = Parent() + c1 = Child() + + @profiling.function_call_count() + def go(): + for i in range(30): + c1.parent = p1 + c1.parent = None + c1.parent = p1 + del c1.parent + go() + + def test_collection_append_remove(self): + Parent, Child = self.classes.Parent, self.classes.Child + p1 = Parent() + children = [Child() for i in range(100)] + + @profiling.function_call_count() + def go(): + for child in children: + p1.children.append(child) + for child in children: + p1.children.remove(child) + go() + diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index bbd8c4dba..d2f8c2256 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -53,6 +53,7 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): c1 in row go() + class ExecutionTest(fixtures.TestBase): def test_minimal_connection_execute(self): diff --git a/test/aaa_profiling/test_zoomark.py b/test/aaa_profiling/test_zoomark.py index 145f3c594..d850782e0 100644 --- a/test/aaa_profiling/test_zoomark.py +++ b/test/aaa_profiling/test_zoomark.py @@ -30,7 +30,6 @@ class ZooMarkTest(fixtures.TestBase): """ __requires__ = 'cpython', __only_on__ = 'postgresql+psycopg2' - __skip_if__ = lambda : sys.version_info < (2, 5), def test_baseline_0_setup(self): global metadata diff --git a/test/aaa_profiling/test_zoomark_orm.py b/test/aaa_profiling/test_zoomark_orm.py index ddcad681a..c9d1438aa 100644 --- a/test/aaa_profiling/test_zoomark_orm.py +++ b/test/aaa_profiling/test_zoomark_orm.py @@ -32,7 +32,6 @@ class ZooMarkTest(fixtures.TestBase): __requires__ = 'cpython', __only_on__ = 'postgresql+psycopg2' - __skip_if__ = lambda : sys.version_info < (2, 5), def test_baseline_0_setup(self): global metadata, session |
