Further configuration to skip initialization during tests

This commit is contained in:
Mathieu Comandon 2021-02-15 16:23:07 -08:00
parent 83c6aed0e0
commit 838b46d0e1
3 changed files with 9 additions and 2 deletions

View file

@ -208,6 +208,7 @@ class Application(Gtk.Application):
self.add_accelerator("<Primary>q", "app.quit")
if os.environ.get("LUTRIS_SKIP_INIT"):
self._print("Skipping initialization")
return
init_dialog = LutrisInitDialog(init_lutris)
init_dialog.run()

View file

@ -0,0 +1,6 @@
import os
def setup_test_environment():
"""Sets up a system to be able to run tests"""
os.environ["LUTRIS_SKIP_INIT"] = "1"

View file

@ -7,15 +7,16 @@ gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from lutris.database import games as games_db
from lutris.game import Game
from lutris.startup import init_lutris
# from lutris import settings
from lutris.gui.config.common import GameDialogCommon
from lutris.gui.config.add_game import AddGameDialog
from lutris.gui.application import Application
from lutris.gui.views.store import sort_func
from lutris.util.test_config import setup_test_environment
from lutris import runners
TEST_PGA_PATH = os.path.join(os.path.dirname(__file__), 'pga.db')
setup_test_environment()
class TestGameDialogCommon(TestCase):
@ -30,7 +31,6 @@ class TestGameDialogCommon(TestCase):
class TestGameDialog(TestCase):
def setUp(self):
init_lutris()
lutris_application = Application()
lutris_window = lutris_application.window
self.dlg = AddGameDialog(lutris_window)