intrumentation ext fixture can leak into test suite and seems to break some of the manager finder tests

Issue #3408 resolved
Mike Bayer repo owner created an issue

this is probably in 0.9, nothing has changed here...might be just a bug in the ext instrumentation and would need a test there

#!

=================================== FAILURES ===================================
___________________ MapperTest.test_unmapped_not_type_error ____________________
[gw2] linux2 -- Python 2.7.6 /var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/bin/python
Traceback (most recent call last):
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/test/orm/test_mapper.py", line 1607, in test_unmapped_not_type_error
    class_mapper, 5
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/testing/assertions.py", line 248, in assert_raises_message
    callable_(*args, **kwargs)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 421, in class_mapper
    mapper = _inspect_mapped_class(class_, configure=configure)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 392, in _inspect_mapped_class
    class_manager = manager_of_class(class_)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/ext/instrumentation.py", line 169, in manager_of_class
    return self._manager_finders.get(cls, _default_manager_getter)(cls)
  File "/opt/python2.7/lib/python2.7/weakref.py", line 284, in get
    return self.data.get(ref(key),default)
TypeError: cannot create weak reference to 'int' object
_______________ MapperTest.test_unmapped_not_type_error_iter_ok ________________
[gw2] linux2 -- Python 2.7.6 /var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/bin/python
Traceback (most recent call last):
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/test/orm/test_mapper.py", line 1614, in test_unmapped_not_type_error_iter_ok
    class_mapper, (5, 6)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/testing/assertions.py", line 248, in assert_raises_message
    callable_(*args, **kwargs)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 421, in class_mapper
    mapper = _inspect_mapped_class(class_, configure=configure)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 392, in _inspect_mapped_class
    class_manager = manager_of_class(class_)
  File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/ext/instrumentation.py", line 169, in manager_of_class
    return self._manager_finders.get(cls, _default_manager_getter)(cls)
  File "/opt/python2.7/lib/python2.7/weakref.py", line 284, in get
    return self.data.get(ref(key),default)
TypeError: cannot create weak reference to 'tuple' object
=========================== short test summary info ============================

Comments (2)

  1. Mike Bayer reporter
    • Repair _reinstall_default_lookups to also flip the _extended flag off again so that test fixtures setup/teardown instrumentation as expected
    • clean up test_extendedattr.py and fix it to no longer leak itself outside by ensuring _reinstall_default_lookups is always called, part of #3408
    • Fixed bug where when using extended attribute instrumentation system, the correct exception would not be raised when :func:.class_mapper were called with an invalid input that also happened to not be weak referencable, such as an integer. fixes #3408

    → <<cset 95949db715ff>>

  2. Mike Bayer reporter
    • Repair _reinstall_default_lookups to also flip the _extended flag off again so that test fixtures setup/teardown instrumentation as expected
    • clean up test_extendedattr.py and fix it to no longer leak itself outside by ensuring _reinstall_default_lookups is always called, part of #3408
    • Fixed bug where when using extended attribute instrumentation system, the correct exception would not be raised when :func:.class_mapper were called with an invalid input that also happened to not be weak referencable, such as an integer. fixes #3408

    (cherry picked from commit 95949db715ff54be01bfd260a51903ede60597ae)

    → <<cset c613ec128ffe>>

  3. Log in to comment