merge stuff

This commit is contained in:
Mike Bayer
2011-04-25 11:32:50 -04:00
8 changed files with 30 additions and 12 deletions
+2
View File
@@ -3,6 +3,8 @@ from test.lib import *
from sqlalchemy.engine import default
class CompileTest(fixtures.TestBase, AssertsExecutionResults):
__requires__ = 'cpython',
@classmethod
def setup_class(cls):
+2 -6
View File
@@ -3,7 +3,6 @@ from sqlalchemy.orm import mapper, relationship, create_session, \
clear_mappers, sessionmaker, class_mapper
from sqlalchemy.orm.mapper import _mapper_registry
from sqlalchemy.orm.session import _sessions
from sqlalchemy.util import jython
import operator
from test.lib import testing, engines
from sqlalchemy import MetaData, Integer, String, ForeignKey, \
@@ -19,11 +18,6 @@ import gc
import weakref
from test.lib import fixtures
if jython:
from nose import SkipTest
raise SkipTest("Profiling not supported on this platform")
class A(fixtures.ComparableEntity):
pass
class B(fixtures.ComparableEntity):
@@ -75,6 +69,8 @@ class EnsureZeroed(fixtures.ORMTest):
class MemUsageTest(EnsureZeroed):
__requires__ = 'cpython',
# ensure a pure growing test trips the assertion
@testing.fails_if(lambda: True)
def test_fixture(self):
+3 -1
View File
@@ -10,6 +10,8 @@ import sys
class MergeTest(fixtures.MappedTest):
__requires__ = 'cpython',
@classmethod
def define_tables(cls, metadata):
parent = Table('parent', metadata, Column('id', Integer,
@@ -115,7 +117,7 @@ class LoadManyToOneFromIdentityTest(fixtures.MappedTest):
# count here,
# so remove some platforms that have wildly divergent
# callcounts.
__requires__ = 'python25',
__requires__ = 'python25', 'cpython'
__unsupported_on__ = 'postgresql+pg8000', 'mysql+pymysql'
@classmethod
+2
View File
@@ -4,6 +4,8 @@ from sqlalchemy.pool import QueuePool
from sqlalchemy import pool as pool_module
class QueuePoolTest(fixtures.TestBase, AssertsExecutionResults):
__requires__ = 'cpython',
class Connection(object):
def rollback(self):
pass
+2 -1
View File
@@ -5,7 +5,7 @@ NUM_RECORDS = 1000
class ResultSetTest(fixtures.TestBase, AssertsExecutionResults):
__requires__ = 'cpython',
__only_on__ = 'sqlite'
@classmethod
@@ -53,6 +53,7 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults):
[tuple(row) for row in t2.select().execute().fetchall()]
class ExecutionTest(fixtures.TestBase):
__requires__ = 'cpython',
__only_on__ = 'sqlite'
def test_minimal_connection_execute(self):
+2
View File
@@ -88,6 +88,7 @@ class SerializeTest(fixtures.MappedTest):
eq_(re_expr.execute().fetchall(), [(7, u'jack'), (8, u'ed'),
(8, u'ed'), (8, u'ed'), (9, u'fred')])
@testing.fails_if(lambda: util.pypy, "problem in pickle")
def test_query(self):
q = Session.query(User).filter(User.name == 'ed'
).options(joinedload(User.addresses))
@@ -134,6 +135,7 @@ class SerializeTest(fixtures.MappedTest):
eq_(list(q2.all()), [(u7, u8), (u7, u9), (u7, u10), (u8, u9),
(u8, u10)])
@testing.fails_if(lambda: util.pypy, "problem in pickle")
def test_any(self):
r = User.addresses.any(Address.email == 'x')
ser = serializer.dumps(r, -1)
+8
View File
@@ -346,6 +346,14 @@ def python25(fn):
)
)
def cpython(fn):
return _chain_decorators_on(
fn,
skip_if(lambda: util.jython or util.pypy,
"cPython interpreter needed"
)
)
def _has_cextensions():
try:
from sqlalchemy import cresultproxy, cprocessors
+9 -4
View File
@@ -1830,22 +1830,27 @@ class ExecutionOptionsTest(QueryTest):
q3_options = dict(foo='not bar', stream_results=True, answer=42)
assert q3._execution_options == q3_options
def test_options_in_connection(self):
User = self.classes.User
execution_options = dict(foo='bar', stream_results=True)
class TQuery(Query):
def instances(self, result, ctx):
eq_(
result.connection._execution_options,
execution_options
)
try:
eq_(
result.connection._execution_options,
execution_options
)
finally:
result.close()
return iter([])
sess = create_session(bind=testing.db, autocommit=False, query_cls=TQuery)
q1 = sess.query(User).execution_options(**execution_options)
q1.all()
class OptionsTest(QueryTest):
"""Test the _get_paths() method of PropertyOption."""