diff --git a/frappy/gui/cfg_editor/utils.py b/frappy/gui/cfg_editor/utils.py index 2e6b03a..b9f7c21 100644 --- a/frappy/gui/cfg_editor/utils.py +++ b/frappy/gui/cfg_editor/utils.py @@ -106,7 +106,8 @@ def get_file_paths(widget, open_file=True): def get_modules(): modules = {} - generalConfig.init() + if not generalConfig.initialized: + generalConfig.init() base_path = generalConfig.basedir # pylint: disable=too-many-nested-blocks for dirname in listdir(base_path): @@ -157,7 +158,8 @@ def get_interface_class_from_name(name): def get_interfaces(): # TODO class must be found out like for modules interfaces = [] - generalConfig.init() + if not generalConfig.initialized: + generalConfig.init() interface_path = path.join(generalConfig.basedir, 'frappy', 'protocol', 'interface') for filename in listdir(interface_path): diff --git a/test/conftest.py b/test/conftest.py index eba9faf..b4b1d76 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -2,20 +2,3 @@ import pytest - -@pytest.fixture(scope="module") -def constants(): - # setup - class Constants: - ONE = 1 - TWO = 2 - c = Constants() - yield c - # teardown - del c - - -# pylint: disable=redefined-builtin -@pytest.fixture(scope="session") -def globals(): - return {} diff --git a/test/test_cfg_editor.py b/test/test_cfg_editor.py new file mode 100644 index 0000000..3ddde76 --- /dev/null +++ b/test/test_cfg_editor.py @@ -0,0 +1,13 @@ +from pathlib import Path + +from frappy.gui.cfg_editor.utils import get_modules, get_interfaces +from frappy.lib import generalConfig + +basedir = Path(__file__).parent.parent.absolute() + + +def test_imports(): + generalConfig.testinit(basedir=basedir) + + get_modules() + get_interfaces() diff --git a/test/test_test.py b/test/test_test.py deleted file mode 100644 index c4ea004..0000000 --- a/test/test_test.py +++ /dev/null @@ -1,14 +0,0 @@ - -from frappy.gui.cfg_editor.utils import get_modules - -def test_assert(): - assert 1 - - -def test_constants(constants): - assert constants.ONE == 1 - assert constants.TWO == 2 - - -def test_imports(): - get_modules()