Make aggregates fully support column aliases

This commit is contained in:
Konsta Vesterinen
2014-12-16 15:41:46 +02:00
parent b1a35fa70d
commit 85170dfb58
2 changed files with 6 additions and 0 deletions

View File

@@ -17,6 +17,10 @@ def count_sql_calls(conn, cursor, statement, parameters, context, executemany):
conn.query_count += 1
except AttributeError:
conn.query_count = 0
try:
conn.queries.append(statement)
except AttributeError:
conn.queries = [statement]
warnings.simplefilter('error', sa.exc.SAWarning)
@@ -55,6 +59,7 @@ class TestCase(object):
def teardown_method(self, method):
aggregates.manager.reset()
self.session.close_all()
self.connection.queries = []
if self.create_tables:
self.Base.metadata.drop_all(self.connection)
self.connection.close()

View File

@@ -76,5 +76,6 @@ class TestAggregateManyToManyAndManyToMany(TestCase):
catalog2 = self.Catalog(products=products)
self.session.add(catalog)
self.session.commit()
print self.connection.queries[-1]
assert catalog.category_count == 1
assert catalog2.category_count == 1