diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-11 15:51:08 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-11 15:51:08 -0400 |
| commit | 48c9993b65dfee9ab36f84dbcf8c27631fb38950 (patch) | |
| tree | 7289f92a978dc7c39cde783f846e7e5b2d1c7ff0 /test/aaa_profiling | |
| parent | 3986fd7626ff29f7debfc72f63ba22235e31ed7e (diff) | |
| download | sqlalchemy-48c9993b65dfee9ab36f84dbcf8c27631fb38950.tar.gz | |
OK! let's turn this around completely. Forget making a single count across
all platforms. let's instead store callcounts for *all* observed platforms in a datafile.
Will try to get enough platforms in the file for jenkins to have meaningful results.
for platforms not in the file, it's just skiptest.
Diffstat (limited to 'test/aaa_profiling')
| -rw-r--r-- | test/aaa_profiling/test_orm.py | 38 | ||||
| -rw-r--r-- | test/aaa_profiling/test_pool.py | 6 | ||||
| -rw-r--r-- | test/aaa_profiling/test_resultset.py | 18 | ||||
| -rw-r--r-- | test/aaa_profiling/test_zoomark.py | 15 | ||||
| -rw-r--r-- | test/aaa_profiling/test_zoomark_orm.py | 13 |
5 files changed, 38 insertions, 52 deletions
diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 498153068..12b43b229 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -10,8 +10,6 @@ import sys class MergeTest(fixtures.MappedTest): - __requires__ = 'cpython', - @classmethod def define_tables(cls, metadata): Table('parent', metadata, Column('id', Integer, @@ -60,19 +58,18 @@ class MergeTest(fixtures.MappedTest): # down from 185 on this this is a small slice of a usually # bigger operation so using a small variance - @profiling.function_call_count(96, variance=0.10) + @profiling.function_call_count(variance=0.10) def go1(): return sess2.merge(p1, load=False) p2 = go1() # third call, merge object already present. almost no calls. - @profiling.function_call_count(16, variance=0.10) + @profiling.function_call_count(variance=0.10) def go2(): return sess2.merge(p2, load=False) go2() - @testing.only_on('sqlite', 'Call counts tailored to pysqlite') def test_merge_load(self): Parent = self.classes.Parent @@ -85,15 +82,17 @@ class MergeTest(fixtures.MappedTest): # using sqlite3 the C extension took it back up to approx. 1257 # (py2.6) - @profiling.function_call_count(1016, variance=.10) + @profiling.function_call_count() def go(): p2 = sess2.merge(p1) go() # one more time, count the SQL + def go2(): + p2 = sess2.merge(p1) sess2 = sessionmaker(testing.db)() - self.assert_sql_count(testing.db, go, 2) + self.assert_sql_count(testing.db, go2, 2) class LoadManyToOneFromIdentityTest(fixtures.MappedTest): """test overhead associated with many-to-one fetches. @@ -105,12 +104,6 @@ class LoadManyToOneFromIdentityTest(fixtures.MappedTest): """ - # only need to test for unexpected variance in a large call - # count here, - # so remove some platforms that have wildly divergent - # callcounts. - __requires__ = 'python25', 'cpython' - __unsupported_on__ = 'postgresql+pg8000', 'mysql+pymysql' @classmethod def define_tables(cls, metadata): @@ -168,7 +161,7 @@ class LoadManyToOneFromIdentityTest(fixtures.MappedTest): parents = sess.query(Parent).all() - @profiling.function_call_count(110761, variance=.2) + @profiling.function_call_count(variance=.2) def go(): for p in parents: p.child @@ -181,14 +174,13 @@ class LoadManyToOneFromIdentityTest(fixtures.MappedTest): parents = sess.query(Parent).all() children = sess.query(Child).all() - @profiling.function_call_count(16988) + @profiling.function_call_count() def go(): for p in parents: p.child go() class MergeBackrefsTest(fixtures.MappedTest): - __only_on__ = 'sqlite' # keep things simple @classmethod def define_tables(cls, metadata): @@ -241,26 +233,26 @@ class MergeBackrefsTest(fixtures.MappedTest): s = Session() s.add_all([ A(id=i, - bs=[B(id=(i * 50) + j) for j in xrange(1, 50)], + bs=[B(id=(i * 5) + j) for j in xrange(1, 5)], c=C(id=i), - ds=[D(id=(i * 50) + j) for j in xrange(1, 50)] + ds=[D(id=(i * 5) + j) for j in xrange(1, 5)] ) - for i in xrange(1, 50) + for i in xrange(1, 5) ]) s.commit() - @profiling.function_call_count(1092497, variance=.10) + @profiling.function_call_count(variance=.10) def test_merge_pending_with_all_pks(self): A, B, C, D = self.classes.A, self.classes.B, \ self.classes.C, self.classes.D s = Session() for a in [ A(id=i, - bs=[B(id=(i * 50) + j) for j in xrange(1, 50)], + bs=[B(id=(i * 5) + j) for j in xrange(1, 5)], c=C(id=i), - ds=[D(id=(i * 50) + j) for j in xrange(1, 50)] + ds=[D(id=(i * 5) + j) for j in xrange(1, 5)] ) - for i in xrange(1, 50) + for i in xrange(1, 5) ]: s.merge(a) diff --git a/test/aaa_profiling/test_pool.py b/test/aaa_profiling/test_pool.py index 11c356c37..6a3d93230 100644 --- a/test/aaa_profiling/test_pool.py +++ b/test/aaa_profiling/test_pool.py @@ -36,7 +36,7 @@ class QueuePoolTest(fixtures.TestBase, AssertsExecutionResults): use_threadlocal=True) - @profiling.function_call_count(47, variance=.15) + @profiling.function_call_count() def test_first_connect(self): conn = pool.connect() @@ -44,7 +44,7 @@ class QueuePoolTest(fixtures.TestBase, AssertsExecutionResults): conn = pool.connect() conn.close() - @profiling.function_call_count(17, variance=.10) + @profiling.function_call_count() def go(): conn2 = pool.connect() return conn2 @@ -53,7 +53,7 @@ class QueuePoolTest(fixtures.TestBase, AssertsExecutionResults): def test_second_samethread_connect(self): conn = pool.connect() - @profiling.function_call_count(6) + @profiling.function_call_count() def go(): return pool.connect() c2 = go() diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index 4cd213389..daee84b97 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -6,17 +6,15 @@ NUM_RECORDS = 1000 class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): - __requires__ = 'cpython', 'cextensions', - __only_on__ = 'sqlite' @classmethod def setup_class(cls): global t, t2, metadata metadata = MetaData(testing.db) - t = Table('table', metadata, *[Column('field%d' % fnum, String) + t = Table('table', metadata, *[Column('field%d' % fnum, String(50)) for fnum in range(NUM_FIELDS)]) t2 = Table('table2', metadata, *[Column('field%d' % fnum, - Unicode) for fnum in range(NUM_FIELDS)]) + Unicode(50)) for fnum in range(NUM_FIELDS)]) def setup(self): metadata.create_all() @@ -34,25 +32,23 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): def teardown(self): metadata.drop_all() - @profiling.function_call_count(316) + @profiling.function_call_count() def test_string(self): [tuple(row) for row in t.select().execute().fetchall()] - @profiling.function_call_count(316) + @profiling.function_call_count() def test_unicode(self): [tuple(row) for row in t2.select().execute().fetchall()] def test_contains_doesnt_compile(self): row = t.select().execute().first() c1 = Column('some column', Integer) + Column("some other column", Integer) - @profiling.function_call_count(9, variance=.15) + @profiling.function_call_count() def go(): c1 in row go() class ExecutionTest(fixtures.TestBase): - __requires__ = 'cpython', - __only_on__ = 'sqlite' def test_minimal_connection_execute(self): # create an engine without any instrumentation. @@ -61,7 +57,7 @@ class ExecutionTest(fixtures.TestBase): # ensure initial connect activities complete c.execute("select 1") - @profiling.function_call_count(40, variance=.10) + @profiling.function_call_count() def go(): c.execute("select 1") go() @@ -72,7 +68,7 @@ class ExecutionTest(fixtures.TestBase): # ensure initial connect activities complete e.execute("select 1") - @profiling.function_call_count(62, variance=.5) + @profiling.function_call_count() def go(): e.execute("select 1") go() diff --git a/test/aaa_profiling/test_zoomark.py b/test/aaa_profiling/test_zoomark.py index 45e83c1b6..97d9f1243 100644 --- a/test/aaa_profiling/test_zoomark.py +++ b/test/aaa_profiling/test_zoomark.py @@ -365,35 +365,34 @@ class ZooMarkTest(fixtures.TestBase): metadata = MetaData(engine) engine.connect() - @profiling.function_call_count(3896) def test_profile_1_create_tables(self): self.test_baseline_1_create_tables() - @profiling.function_call_count(4200) + @profiling.function_call_count() def test_profile_1a_populate(self): self.test_baseline_1a_populate() - @profiling.function_call_count(218) + @profiling.function_call_count() def test_profile_2_insert(self): self.test_baseline_2_insert() - @profiling.function_call_count(2700) + @profiling.function_call_count() def test_profile_3_properties(self): self.test_baseline_3_properties() - @profiling.function_call_count(8500) + @profiling.function_call_count() def test_profile_4_expressions(self): self.test_baseline_4_expressions() - @profiling.function_call_count(875, variance=0.10) + @profiling.function_call_count() def test_profile_5_aggregates(self): self.test_baseline_5_aggregates() - @profiling.function_call_count(1475) + @profiling.function_call_count() def test_profile_6_editing(self): self.test_baseline_6_editing() - @profiling.function_call_count(1970) + @profiling.function_call_count() def test_profile_7_multiview(self): self.test_baseline_7_multiview() diff --git a/test/aaa_profiling/test_zoomark_orm.py b/test/aaa_profiling/test_zoomark_orm.py index 10dafd6e0..64ceb46ff 100644 --- a/test/aaa_profiling/test_zoomark_orm.py +++ b/test/aaa_profiling/test_zoomark_orm.py @@ -331,31 +331,30 @@ class ZooMarkTest(fixtures.TestBase): session = sessionmaker(engine)() engine.connect() - @profiling.function_call_count(5600, variance=0.25) def test_profile_1_create_tables(self): self.test_baseline_1_create_tables() - @profiling.function_call_count(5786) + @profiling.function_call_count() def test_profile_1a_populate(self): self.test_baseline_1a_populate() - @profiling.function_call_count(388) + @profiling.function_call_count() def test_profile_2_insert(self): self.test_baseline_2_insert() - @profiling.function_call_count(5702) + @profiling.function_call_count() def test_profile_3_properties(self): self.test_baseline_3_properties() - @profiling.function_call_count(16303) + @profiling.function_call_count() def test_profile_4_expressions(self): self.test_baseline_4_expressions() - @profiling.function_call_count(900) + @profiling.function_call_count() def test_profile_5_aggregates(self): self.test_baseline_5_aggregates() - @profiling.function_call_count(2545) + @profiling.function_call_count() def test_profile_6_editing(self): self.test_baseline_6_editing() |
