Skip to content
Snippets Groups Projects
Verified Commit d29ea9f8 authored by David Hoese's avatar David Hoese
Browse files

Fix tests to explicitly create application objects

parent ca3c6812
No related branches found
No related tags found
No related merge requests found
......@@ -1128,6 +1128,15 @@ def _search_paths(arglist):
yield subpath
def create_app() -> (app.Application, QtWidgets.QApplication):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
vispy_app = app.use_app('pyqt5')
qt_app = vispy_app.create()
if hasattr(QtWidgets.QStyleFactory, 'AA_UseHighDpiPixmaps'):
qt_app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
return vispy_app, qt_app
def main():
import argparse
parser = argparse.ArgumentParser(description="Run SIFT")
......@@ -1171,11 +1180,7 @@ def main():
LOG.info("Using configuration directory: %s", args.config_dir)
LOG.info("Using cache directory: %s", args.cache_dir)
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
vispy_app = app.use_app('pyqt5')
qt_app = vispy_app.create()
if hasattr(QtWidgets.QStyleFactory, 'AA_UseHighDpiPixmaps'):
qt_app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
vispy_app, qt_app = create_app()
# Add our own fonts to Qt windowing system
font_pattern = os.path.join(get_package_data_dir(), 'fonts', '*')
......
import pytest
from uwsift.__main__ import Main
from uwsift.__main__ import Main, create_app
from uwsift.util.default_paths import USER_CONFIG_DIR
from PyQt5.QtTest import QTest
......@@ -7,6 +7,7 @@ from PyQt5.QtTest import QTest
@pytest.fixture(scope="session")
def window(tmp_path_factory):
"""Provides the SIFT GUI to tests."""
vispy_app, qt_app = create_app() # noqa
d = tmp_path_factory.mktemp("tmp")
window = Main(config_dir=USER_CONFIG_DIR, workspace_dir=str(d))
window.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment