Updated openstack/openstack
Project: openstack/oslo.db  93f41a43efb90d0d718e4b7b1f8dbe1d6f218f94

Consolidate sqlite and mysql event listeners

This patch refactors the SQLite and MySQL event listener
setup in session.py to occur inline within the
new _init_events() hooks for each of these backends.  This
is to improve code readability and reduce unneeded boilerplate.

In particular, _mysql_set_mode_callback() was implemented using
four functions, all private to session.py, unused anywhere
else and also not consistently prefixed with "_mysql".
These functions have been consolidated into a single event
listen plus a quick check of SQL mode.   In particular,
the system now emits the logging check for "sql_mode"
in all cases.

On the SQLite side, three functions, again not all prefixed
with _sqlite, are consolidated into a single event listening
function wihtin _init_events().

The test suite is altered in several ways.  The tests
for connect arguments no longer inject a sqlite engine
into session.create_engine(); now that MySQL does a particular
statement every time, this was no longer feasible, and in general
other setup functions might emit SQL also, so the
CreateEngineTest tests now test directly into session._init_connection_args.
The tests for MySQL modes and SQLite connection settings
move into being plain round-trip tests, reducing lots of
mocking logic and ultimately doing a more complete test against
a real backend.

Change-Id: I04ca3fbb1f46a64ed6552496ae995f77aa0b2315