]> git.phdru.name Git - m_librarian.git/blob - tests/dbutils.py
Style: Re-group and reorder imports
[m_librarian.git] / tests / dbutils.py
1
2 import os
3
4 from sqlobject.tests.dbtest import getConnection
5
6 from m_librarian.db import open_db, init_db
7 from m_librarian.inp import import_inpx
8
9 __all__ = ['setup_module', 'teardown_module', 'load_inpx']
10
11
12 def setup_module():
13     connection = getConnection()
14     if connection.dbName == 'sqlite':
15         try:
16             connection.dropDatabase()
17         except OSError:
18             pass
19     open_db(connection.uri())
20     init_db()
21
22
23 def teardown_module():
24     connection = getConnection()
25     if connection.dbName == 'sqlite':
26         try:
27             connection.dropDatabase()
28         except OSError:
29             pass
30
31
32 def load_inpx(inpx):
33     import_inpx(os.path.join(os.path.dirname(__file__), inpx))