stefanofontanelli/ColanderAlchemy

ALL tests fail when using SQLAlchemy >= 0.9a

tisdall opened this issue · 1 comments

You can bypass the issues by not using event.listen(mapper, 'mapper_configured', setup_schema) and not having any relationships in your objects.

======================================================================
ERROR: test_add_nodes_exceptions (tests.test_schema.TestsSQLAlchemySchemaNode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sites/ColanderAlchemy/tests/test_schema.py", line 64, in test_add_nodes_exceptions
    self.assertRaises(ValueError, SQLAlchemySchemaNode, Account, includes, excludes)
  File "/usr/lib64/python3.3/unittest/case.py", line 570, in assertRaises
    return context.handle('assertRaises', callableObj, args, kwargs)
  File "/usr/lib64/python3.3/unittest/case.py", line 135, in handle
    callable_obj(*args, **kwargs)
  File "/sites/ColanderAlchemy/colanderalchemy/schema.py", line 112, in __init__
    self.add_nodes(self.includes, self.excludes, self.overrides)
  File "/sites/ColanderAlchemy/colanderalchemy/schema.py", line 116, in add_nodes
    for prop in self.inspector.attrs:
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 689, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/orm/mapper.py", line 1943, in attrs
    configure_mappers()
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/orm/mapper.py", line 2542, in configure_mappers
    mapper, mapper.class_)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/attr.py", line 216, in __call__
    fn(*args, **kw)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/orm/events.py", line 527, in wrap
    wrapped_fn(*arg, **kw)
  File "/sites/ColanderAlchemy/colanderalchemy/__init__.py", line 37, in setup_schema
    setattr(class_, __colanderalchemy__, SQLAlchemySchemaNode(class_))
  File "/sites/ColanderAlchemy/colanderalchemy/schema.py", line 112, in __init__
    self.add_nodes(self.includes, self.excludes, self.overrides)
  File "/sites/ColanderAlchemy/colanderalchemy/schema.py", line 136, in add_nodes
    node = getattr(self, factory)(prop, overrides.get(name,{}).copy())
  File "/sites/ColanderAlchemy/colanderalchemy/schema.py", line 421, in get_schema_from_relationship
    includes = [p.key for p in inspect(class_).column_attrs]
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/inspection.py", line 74, in inspect
    type_)
sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type <class 'sqlalchemy.ext.declarative.clsregistry._class_resolver'>

======================================================================
FAIL: test_clone (tests.test_schema.TestsSQLAlchemySchemaNode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sites/ColanderAlchemy/tests/test_schema.py", line 50, in setUp
    event.listen(mapper, 'mapper_configured', setup_schema)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/api.py", line 49, in listen
    _event_key(target, identifier, fn).listen(*args, **kw)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/registry.py", line 176, in listen
    self.dispatch_target.dispatch._listen(self, *args, **kw)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/orm/events.py", line 538, in _listen
    event_key.base_listen()
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/registry.py", line 215, in base_listen
    for_modify(target.dispatch).append(self, propagate)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/attr.py", line 115, in append
    registry._stored_in_collection(event_key, self)
  File "/sites/ColanderAlchemy/SQLAlchemy-0.9.1-py3.3-linux-x86_64.egg/sqlalchemy/event/registry.py", line 71, in _stored_in_collection
    assert dispatch_reg[owner_ref] == listen_ref
AssertionError


....

#41 fixes this issue