fixup test for cfg_editor utils to run from non-checkout, and fix names, and remove example code

Change-Id: I6224244392e2a2d0928065ba24abcbe822096084
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/34934
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
This commit is contained in:
Georg Brandl 2024-11-07 10:36:11 +01:00 committed by Markus Zolliker
parent 2d824978a9
commit 554996ffd3
4 changed files with 17 additions and 33 deletions

View File

@ -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):

View File

@ -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 {}

13
test/test_cfg_editor.py Normal file
View File

@ -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()

View File

@ -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()