]> git.phdru.name Git - m_librarian.git/blob - tests/__init__.py
c624381b6ad0e053f6cf370b1ea16d3b67df18dc
[m_librarian.git] / tests / __init__.py
1
2 __all__ = ['TestCase', 'main']
3
4
5 import os
6 import unittest
7 from m_librarian.db import open_db, init_db
8
9
10 class TestCase(unittest.TestCase):
11     def setUp(self):
12         try:
13             os.remove('/tmp/m_librarian-test.sqlite')
14         except OSError:
15             pass
16         open_db('sqlite:///tmp/m_librarian-test.sqlite')
17         init_db()
18
19     def tearDown(self):
20         try:
21             os.remove('/tmp/m_librarian-test.sqlite')
22         except OSError:
23             pass
24
25
26 def main():
27     try:
28         unittest.main(testRunner=unittest.TextTestRunner())
29     except SystemExit, msg:
30         result = msg.args[0]
31     else:
32         result = 0
33     raise SystemExit(result)