1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Fixed tests

This commit is contained in:
spl0k 2018-08-29 18:18:31 +02:00
parent e84459d627
commit 659e46611a

View File

@ -540,12 +540,19 @@ def init_database(database_uri):
execute_sql_resource_script('schema/migration/{}/{}'.format(settings['provider'], migration))
version.value = SCHEMA_VERSION
# Hack for in-memory SQLite databases (used in tests), otherwise 'db' and 'metadb' would be two distinct databases
# and 'db' wouldn't have any table
if settings['provider'] == 'sqlite' and settings['filename'] == ':memory:':
db.provider = metadb.provider
else:
metadb.disconnect()
db.bind(**settings)
db.generate_mapping(check_tables = False)
def release_database():
metadb.disconnect()
db.disconnect()
db.provider = None
db.schema = None
db.provider = metadb.provider = None
db.schema = metadb.schema = None