summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
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