From 9b0ffae8610acb155aa653ecc7efa695b58156c8 Mon Sep 17 00:00:00 2001 From: Pierre Raybaut Date: Sun, 22 Oct 2023 19:18:03 +0200 Subject: [PATCH] Fixed: guidata can be imported w/o Qt --- guidata/configtools.py | 3 +-- guidata/tests/test_no_qt.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/guidata/configtools.py b/guidata/configtools.py index ed37948..04b358b 100644 --- a/guidata/configtools.py +++ b/guidata/configtools.py @@ -43,8 +43,6 @@ from collections.abc import Callable from typing import TYPE_CHECKING -from qtpy import PYQT5 - from guidata.utils.misc import decode_fs_string, get_module_path if TYPE_CHECKING: # pragma: no cover @@ -293,6 +291,7 @@ def font_is_installed(font: str) -> list[str]: list[str]: list of installed fonts """ # Importing Qt here because this module should be independent from it + from qtpy import PYQT5 from qtpy import QtGui as QG # pylint: disable=import-outside-toplevel if PYQT5: diff --git a/guidata/tests/test_no_qt.py b/guidata/tests/test_no_qt.py index 9d98112..f54fdff 100644 --- a/guidata/tests/test_no_qt.py +++ b/guidata/tests/test_no_qt.py @@ -10,11 +10,10 @@ import os -os.environ["QT_API"] = "invalid_value" # Invalid Qt API - def test_imports_without_qt(): """Test if some guidata features work without Qt""" + os.environ["QT_API"] = "invalid_value" # Invalid Qt API try: # pylint: disable=unused-import # pylint: disable=import-outside-toplevel