From caa1c3ccdf94ee20140b3964aab0ad3058e03699 Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Sun, 7 Feb 2016 15:28:56 +0000 Subject: Create test framework --- tests/conftest.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/conftest.py (limited to 'tests/conftest.py') 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 -- cgit v1.2.3