Commit 7a98b3bf authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

CT-69: Add assertpy module for tests.

Updated the MidCspSubarrayBase interface.
Added the path to load the filename configuration in the acceptance tests.
Add the "id" key in the json configuration files.
parent d927ae3d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -724,7 +724,7 @@
      <eventCriteria relChange="" absChange="5" period=""/>
    </attributes>
    <attributes name="isCmdInProgress" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
      <dataType xsi:type="pogoDsl:EnumType"/>
      <dataType xsi:type="pogoDsl:BooleanType"/>
      <changeEvent fire="false" libCheckCriteria="false"/>
      <archiveEvent fire="false" libCheckCriteria="false"/>
      <status abstract="false" inherited="true" concrete="true"/>
+2 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ setup(
        install_requires = [
            'pytango >=9.3.1',
            'future',
            'csp-lmc-common > 0.5.7'
            'csp-lmc-common'
        ],
        setup_requires=[
            'pytest-runner',
@@ -60,6 +60,7 @@ setup(
            'pytest-cov',
            'pytest-json-report',
            'pycodestyle',
            'assertpy',
        ],
        extras_require={
            'dev':  ['prospector[with_pyroma]', 'yapf', 'isort']
+4 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ class TestCspSubarray(object):
        """
        obs_state = midcsp_subarray01.obsState
        assert obs_state == ObsState.READY
        midcsp_subarray01.Scan(" ")
        midcsp_subarray01.Scan("1")
        time.sleep(2)
        obs_state = midcsp_subarray01.obsState
        assert obs_state == ObsState.SCANNING
@@ -368,3 +368,6 @@ class TestCspSubarray(object):
        assert ((obs_state2 == 2) and (obs_state1 == 2))
        time.sleep(1)
        assert not midcsp_subarray01.timeoutExpiredFlag 
        midcsp_subarray01.GotToIdle()
        midcsp_subarray02.GotToIdle()
        time.sleep(3)
+14 −2
Original line number Diff line number Diff line
@@ -27,13 +27,25 @@ from ska.base.control_model import ObsState
from utils import Poller, Probe
from assertpy import assert_that

# Path
file_path = os.path.dirname(os.path.abspath(__file__))
# insert base package directory to import global_enum
# module in commons folder
data_pkg_path = os.path.abspath(os.path.join(file_path, "./tests/acceptance_tests/"))
sys.path.insert(0, data_pkg_path)

path = os.path.join(os.path.dirname(__file__), os.pardir)
sys.path.insert(0, os.path.abspath(path))

LOGGER = logging.getLogger(__name__)


def prepare_configuration_string(filename="test_ConfigureScan_ADR4.json"):
    """Create the config string for CSP-CBF"""
    try:
        json_file = open(filename)
        file_to_load = file_path + '/' + filename
        LOGGER.info(f"Reading configuration from {filefile_to_load}")
        json_file = open(file_to_load)
        configuration_string = json_file.read().replace("\n", "")
        return configuration_string
    except Exception as e:
@@ -163,7 +175,7 @@ class TestCspSubarrayConfiguration(TestBase):
        if tango_err:
            err_msg = str(tango_err.value.args[0].desc)
            # TODO: aggiungere quale device fallisce
            LOGGER.info(f"Command configure failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}")
            LOGGER.warning(f"Command configure failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}")
        # check
        obs_state = self.midcsp_subarray01.obsState
        #assert obs_state == ObsState.IDLE, f"CSP Subarray obsState has wrong value ({obs_state})"
+1 −1
Original line number Diff line number Diff line
{
    "id": 1,
    "id": "sbi-mvp01-20200325-00001-science_A",
    "frequencyBand": "1",
    "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/delayModel",

Loading