2e79681670
Currently, sqlalchemy.ModelBase.__contains__() catches any exception, and by doing that, it hides real bugs. For example, a Nova unit test raises the following error, but __contains__() simply returns False: sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <InstanceExtra at 0x7fea635bc5f8> is not bound to a Session; deferred load operation of attribute 'pci_requests' cannot proceed On Python 3, hasattr() calls getattr(): it returns True if getattr() succeeds, False if getattr() raises an AttributeError, or passes through the exception, if getattr() failed for a different reason. On Python 2, hasattr() also calls getattr(), but it catches *any* exception. This change replaces hasattr() with getattr(), and it only catches AttributeError as Python 3, so passes through sqlalchemy exceptions. Add an unit test to test the new behaviour. Closes-Bug: #1469225 Change-Id: If9c3ccc03f1dc9746936b0b83ea132508491e577 |
||
---|---|---|
.. | ||
__init__.py | ||
test_enginefacade.py | ||
test_exc_filters.py | ||
test_handle_error.py | ||
test_migrate_cli.py | ||
test_migration_common.py | ||
test_migrations.py | ||
test_models.py | ||
test_options.py | ||
test_provision.py | ||
test_sqlalchemy.py | ||
test_update_match.py | ||
test_utils.py |