mirror of
https://github.com/lutris/lutris.git
synced 2026-06-21 12:20:15 -04:00
Use test database for tests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/python
|
||||
import unittest
|
||||
import os
|
||||
from sqlite3 import IntegrityError, OperationalError
|
||||
|
||||
Reference in New Issue
Block a user