diff --git a/tests/test_dialogs.py b/tests/test_dialogs.py index 766280b26..600c0872c 100644 --- a/tests/test_dialogs.py +++ b/tests/test_dialogs.py @@ -1,10 +1,25 @@ import os from gi.repository import Gio from lutris.game import Game +from lutris import pga from lutris.gui import config_dialogs from unittest import TestCase from lutris import runners +TEST_PGA_PATH = os.path.join(os.path.dirname(__file__), 'pga.db') + + +class DatabaseTester(TestCase): + def setUp(self): + pga.PGA_DB = TEST_PGA_PATH + if os.path.exists(TEST_PGA_PATH): + os.remove(TEST_PGA_PATH) + pga.syncdb() + + def tearDown(self): + if os.path.exists(TEST_PGA_PATH): + os.remove(TEST_PGA_PATH) + class TestGameDialogCommon(TestCase): def test_get_runner_liststore(self): @@ -15,7 +30,7 @@ class TestGameDialogCommon(TestCase): self.assertEqual(list_store[1][1], runners.__all__[0]) -class TestGameDialog(TestCase): +class TestGameDialog(DatabaseTester): def test_dialog(self): dlg = config_dialogs.AddGameDialog(None) self.assertEqual(dlg.notebook.get_current_page(), 0) diff --git a/tests/test_pga.py b/tests/test_pga.py index 449a361a4..deb6a5497 100644 --- a/tests/test_pga.py +++ b/tests/test_pga.py @@ -1,4 +1,3 @@ -#!/usr/bin/python import unittest import os from sqlite3 import IntegrityError, OperationalError