mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Fixed tests
This commit is contained in:
parent
e84459d627
commit
659e46611a
@ -540,12 +540,19 @@ def init_database(database_uri):
|
|||||||
execute_sql_resource_script('schema/migration/{}/{}'.format(settings['provider'], migration))
|
execute_sql_resource_script('schema/migration/{}/{}'.format(settings['provider'], migration))
|
||||||
version.value = SCHEMA_VERSION
|
version.value = SCHEMA_VERSION
|
||||||
|
|
||||||
metadb.disconnect()
|
# Hack for in-memory SQLite databases (used in tests), otherwise 'db' and 'metadb' would be two distinct databases
|
||||||
db.bind(**settings)
|
# 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)
|
db.generate_mapping(check_tables = False)
|
||||||
|
|
||||||
def release_database():
|
def release_database():
|
||||||
|
metadb.disconnect()
|
||||||
db.disconnect()
|
db.disconnect()
|
||||||
db.provider = None
|
db.provider = metadb.provider = None
|
||||||
db.schema = None
|
db.schema = metadb.schema = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user