python tests: made easier to toggle db backend

Made possible to select the db backend to use via an environment variable.

Added method which automatically reads db settings and initializes db connection.