summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2016-02-07 15:28:56 +0000
committerMichaël Ball <michael.ball@gmail.com>2016-07-15 07:15:13 +0100
commitcaa1c3ccdf94ee20140b3964aab0ad3058e03699 (patch)
tree12de8657e4fe4533a62c8693cb8cdaa90a74e27f /tests/conftest.py
parentea4391ba43fab82b8f1fbf2f9ab939e60d5e0bc2 (diff)
Create test framework
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..0028475
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,44 @@
+import os
+
+import pytest
+
+from db.db_manager import DbManager
+
+
+@pytest.fixture(scope="module")
+def database(request):
+ database = DbManager(
+ db=os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ "test.db"))
+
+ def fin():
+ database.close()
+
+ request.addfinalizer(fin)
+
+ return database
+
+
+@pytest.fixture(scope="module")
+def test_file():
+ test_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ "test.ogg")
+
+ return test_file
+
+
+@pytest.fixture(scope="class")
+def app(request):
+ db = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ "testapp.db")
+ library_db = DbManager(
+ db=os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ "test.db"))
+
+ def fin():
+ library_db.close()
+
+ request.addfinalizer(fin)
+
+ request.cls.db = db
+ request.cls.library_db = library_db