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:
parent
2d824978a9
commit
554996ffd3
@ -106,6 +106,7 @@ def get_file_paths(widget, open_file=True):
|
|||||||
|
|
||||||
def get_modules():
|
def get_modules():
|
||||||
modules = {}
|
modules = {}
|
||||||
|
if not generalConfig.initialized:
|
||||||
generalConfig.init()
|
generalConfig.init()
|
||||||
base_path = generalConfig.basedir
|
base_path = generalConfig.basedir
|
||||||
# pylint: disable=too-many-nested-blocks
|
# pylint: disable=too-many-nested-blocks
|
||||||
@ -157,6 +158,7 @@ def get_interface_class_from_name(name):
|
|||||||
def get_interfaces():
|
def get_interfaces():
|
||||||
# TODO class must be found out like for modules
|
# TODO class must be found out like for modules
|
||||||
interfaces = []
|
interfaces = []
|
||||||
|
if not generalConfig.initialized:
|
||||||
generalConfig.init()
|
generalConfig.init()
|
||||||
interface_path = path.join(generalConfig.basedir, 'frappy',
|
interface_path = path.join(generalConfig.basedir, 'frappy',
|
||||||
'protocol', 'interface')
|
'protocol', 'interface')
|
||||||
|
@ -2,20 +2,3 @@
|
|||||||
|
|
||||||
import pytest
|
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
13
test/test_cfg_editor.py
Normal 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()
|
@ -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()
|
|
Loading…
x
Reference in New Issue
Block a user