Test failures with Python 3.4
SQLAlchemy test suite has at least 11 errors and at least 3 failures with Python 3.4.
test.orm.test_attributes.AttributesTest.test_pickleness() fails due to hash randomization, so it might be necessary to run test suite multiple times to reproduce this failure.
I attach output of test suite of SQLAlchemy trunk with snapshot of Python 3.4 from today.
Comments (10)
-
repo owner -
repo owner new python issue added http://bugs.python.org/issue20828
-
repo owner OK so far:
ERROR: test.orm.test_composites.PointTest.test_delete
http://bugs.python.org/issue20786
ERROR: test.ext.test_horizontal_shard.AttachedFileShardTest.test_roundtrip ERROR: test.ext.test_horizontal_shard.AttachedFileShardTest.test_shard_id_event ERROR: test.ext.test_horizontal_shard.DistinctEngineShardTest.test_roundtrip ERROR: test.ext.test_horizontal_shard.DistinctEngineShardTest.test_shard_id_event ERROR: test.sql.test_defaults.DefaultTest.test_insert ERROR: test.sql.test_defaults.DefaultTest.test_insert_values ERROR: test.sql.test_defaults.DefaultTest.test_insertmany ERROR: test.sql.test_defaults.DefaultTest.test_update ERROR: test.sql.test_defaults.DefaultTest.test_update_values ERROR: test.sql.test_defaults.DefaultTest.test_updatemany
-
repo owner yeah and again, these:
FAIL: test.base.test_utils.TestFormatArgspec.test_init_bare FAIL: test.base.test_utils.TestFormatArgspec.test_init_grouped
are because object.init is allowing inspection, which we're not expecting.
-
repo owner this will resolve the default-related issues:
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index a9d5a69..787c72d 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -27,6 +27,7 @@ Since these objects are part of the SQL expression language, they are usable as components in SQL expressions. """ +from __future__ import absolute_import import inspect from .. import exc, util, event, inspection @@ -41,6 +42,7 @@ from .selectable import TableClause import collections import sqlalchemy from . import ddl +import types RETAIN_SCHEMA = util.symbol('retain_schema') @@ -1844,7 +1846,9 @@ class ColumnDefault(DefaultGenerator): on everyone. """ - if inspect.isfunction(fn) or inspect.ismethod(fn): + if isinstance(fn, (types.BuiltinMethodType, types.BuiltinFunctionType)): + return lambda ctx: fn() + elif inspect.isfunction(fn) or inspect.ismethod(fn): inspectable = fn elif inspect.isclass(fn): inspectable = fn.__init__
-
repo owner this will fix those failures:
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 82e37ce..94ddb24 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -362,15 +362,15 @@ def format_argspec_init(method, grouped=True): other unreflectable (usually C) -> (self, *args, **kwargs) """ - try: - return format_argspec_plus(method, grouped=grouped) - except TypeError: - if method is object.__init__: - args = grouped and '(self)' or 'self' - else: + if method is object.__init__: + args = grouped and '(self)' or 'self' + else: + try: + return format_argspec_plus(method, grouped=grouped) + except TypeError: args = (grouped and '(self, *args, **kwargs)' or 'self, *args, **kwargs') - return dict(self_arg='self', args=args, apply_pos=args, apply_kw=args) + return dict(self_arg='self', args=args, apply_pos=args, apply_kw=args) def getargspec_init(method):
-
repo owner for the pickle thing that's some stupid old cruft
diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py index c282bc4..4f8092f 100644 --- a/test/orm/test_attributes.py +++ b/test/orm/test_attributes.py @@ -236,21 +236,6 @@ class AttributesTest(fixtures.ORMTest): o2 = pickle.loads(pk_o) pk_o2 = pickle.dumps(o2) - # so... pickle is creating a new 'mt2' string after a roundtrip here, - # so we'll brute-force set it to be id-equal to the original string - if False: - o_mt2_str = [ k for k in o.__dict__ if k == 'mt2'][0] - o2_mt2_str = [ k for k in o2.__dict__ if k == 'mt2'][0] - self.assert_(o_mt2_str == o2_mt2_str) - self.assert_(o_mt2_str is not o2_mt2_str) - # change the id of o2.__dict__['mt2'] - former = o2.__dict__['mt2'] - del o2.__dict__['mt2'] - o2.__dict__[o_mt2_str] = former - - # Relies on dict ordering - if not jython: - self.assert_(pk_o == pk_o2) # the above is kind of distrurbing, so let's do it again a little # differently. the string-id in serialization thing is just an @@ -261,11 +246,6 @@ class AttributesTest(fixtures.ORMTest): o3 = pickle.loads(pk_o2) pk_o3 = pickle.dumps(o3) o4 = pickle.loads(pk_o3) - pk_o4 = pickle.dumps(o4) - - # Relies on dict ordering - if not jython: - self.assert_(pk_o3 == pk_o4) # and lastly make sure we still have our data after all that. # identical serialzation is great, *if* it's complete :)
-
repo owner - changed status to resolved
- Fixed some test/feature failures occurring in Python 3.4,
in particular the logic used to wrap "column default" callables
wouldn't work properly for Python built-ins.
fixes
#2979
→ <<cset 6750c39a4fc6>>
-
repo owner so the
__delete__()
error remains but they definitely seem like they're going to fix that one for the 3.4 release. -
repo owner - get util.get_callable_argspec() to be completely bulletproof for 2.6-3.4, methods, classes, builtins, functools.partial(), everything known so far
- use get_callable_argspec() within ColumnDefault._maybe_wrap_callable, re:
#2979
→ <<cset bf89ca2e10ff>>
- Log in to comment
note that 3.4.0rc2 still has issues including http://bugs.python.org/issue20786 which was reported as a result of one of these failures. http://bugs.python.org/issue17482 was found due to an Alembic failure.
overall its possible that most of these other failures are also python regressions which does make this a little bit urgent, considering that SQLAlchemy projects have already found two regressions in 3.4.