Commit 76024c0b authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

AT5-259: pytest configuration files. First tests for MID classes.

parent 7e4f7825
Loading
Loading
Loading
Loading
+76 −0
Original line number Diff line number Diff line
{
    "scanID": 1,
    "frequencyBand": "5a",
    "band5Tuning": [5.85, 7.25],
    "frequencyBandOffsetStream1": 0,
    "frequencyBandOffsetStream2": 0,
    "dopplerPhaseCorrSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/dopplerPhaseCorrection",
    "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/delayModel",
    "visDestinationAddressSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/visDestinationAddress",
    "rfiFlaggingMask": {},
    "searchWindow": [
        {
            "searchWindowID": 1,
            "searchWindowTuning": 6000000000,
            "tdcEnable": false,
            "tdcNumBits": 8,
            "tdcPeriodBeforeEpoch": 5,
            "tdcPeriodAfterEpoch": 25,
            "tdcDestinationAddress": [
                {
                    "receptorID": 4,
                    "tdcDestinationAddress": ["foo", "bar", "8080"]
                },
                {
                    "receptorID": 1,
                    "tdcDestinationAddress": ["fizz", "buzz", "80"]
                }
            ]
        },
        {
            "searchWindowID": 2,
            "searchWindowTuning": 7000000000,
            "tdcEnable": false
        }
    ],
    "fsp": [
        {
            "fspID": 1,
            "functionMode": "CORR",
            "receptors": [4],
            "frequencySliceID": 1,
            "corrBandwidth": 1,
            "zoomWindowTuning": 4700000,
            "integrationTime": 140,
            "channelAveragingMap": [
                [1, 8],
                [745, 0],
                [1489, 0],
                [2233, 0],
                [2977, 0],
                [3721, 0],
                [4465, 0],
                [5209, 0],
                [5953, 0],
                [6697, 0],
                [7441, 0],
                [8185, 0],
                [8929, 0],
                [9673, 0],
                [10417, 0],
                [11161, 0],
                [11905, 0],
                [12649, 0],
                [13393, 0],
                [14137, 0]
            ]
        },
        {
            "fspID": 2,
            "functionMode": "CORR",
            "frequencySliceID": 20,
            "corrBandwidth": 0,
            "integrationTime": 1400
        }
    ]
}
+69 −0
Original line number Diff line number Diff line
"""
A module defining a list of fixture functions that are shared across all the skabase
tests.
"""
#from __future__ import absolute_import
#import mock
import pytest

#sys.path.insert(0, "../commons")

import tango
#from tango.test_context import DeviceTestContext

#import global_enum

@pytest.fixture(scope="class")
def midcsp_master():
    """Create DeviceProxy for the MidCspMaster device
       to test the device with the TANGO DB
    """
    database = tango.Database()
    instance_list = database.get_device_exported_for_class('MidCspMasterBase')
    for instance in instance_list.value_string:
        try:
            return tango.DeviceProxy(instance)
        except tango.DevFailed:
            continue

@pytest.fixture(scope="class")
def midcsp_subarray01():
    """Create DeviceProxy for the CspMaster device
       to test the device with the TANGO DB
    """
    database = tango.Database()
    instance_list = database.get_device_exported_for_class('MidCspSubarrayBase')
    for instance in instance_list.value_string:
        try:
            if "subarray_01" in instance:
                return tango.DeviceProxy(instance)
        except tango.DevFailed:
            continue

@pytest.fixture(scope="class")
def cbf_subarray01():
    """Create DeviceProxy for the CspMaster device
       to test the device with the TANGO DB
    """
    database = tango.Database()
    instance_list = database.get_device_exported_for_class('CbfSubarray')
    for instance in instance_list.value_string:
        try:
            if "subarray_01" in instance:
                return tango.DeviceProxy(instance)
        except tango.DevFailed:
            continue

@pytest.fixture(scope="class")
def cbf_master():
    """Create DeviceProxy for the CspMaster device
       to test the device with the TANGO DB
    """
    database = tango.Database()
    instance_list = database.get_device_exported_for_class('CbfMaster')
    for instance in instance_list.value_string:
        try:
            return tango.DeviceProxy(instance)
        except tango.DevFailed:
            continue
+20 −0
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
#
# This file is part of the CentralNode project
#
#
#
# Distributed under the terms of the BSD-3-Clause license.
# See LICENSE.txt for more info.

"""Release information for Python Package"""

name = """mid-csp-lmc"""
version = "0.3.0"
version_info = version.split(".")
description = """SKA MID CSP.LMC"""
author = "INAF-OAA"
author_email = "elisabetta.giani@inaf.it"
license = """BSD-3-Clause"""
url = """https://gitlab.com/ska-telescope/csp-lmc.git"""
copyright = """INAF, SKA Telescope"""
+34 −0
Original line number Diff line number Diff line
# Use bash shell with pipefail option enabled so that the return status of a
# piped command is the value of the last (rightmost) commnand to exit with a
# non-zero status. This lets us pipe output into tee but still exit on test
# failures.
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c

all: test lint

# wait for the device to be available before beginning the test
# A temporary volume is mounted at /build when 'make test' is executing.
# The following steps copy across useful output to this volume which can
# then be extracted to form the CI summary for the test procedure.
test:
	retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/master
	retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_01
	retry --max=10 -- tango_admin --ping-device mid_csp/elt/master
	retry --max=10 -- tango_admin --ping-device mid_csp/elt/subarray_01
	cd /app && python setup.py test | tee setup_py_test.stdout
	if [ -d /build ]; then \
		mv /app/setup_py_test.stdout /build/csp_master_setup_test.stdout; \
		mv /app/htmlcov /build/csp_master_htmlcov; \
		mv /app/coverage.xml /build/csp_master_coverage.xml; \
	fi;
lint:
	# pylint needs to run twice
	cd /app && pylint -f colorized csp-lmc-mid| tee code_analysis.stdout; \
	cd /app && pylint csp-lmc-mid > lint_output.xml; \
	if [ -d /build ]; then \
		mv /app/code_analysis.stdout /build/csplmc_code_analysis.stdout; \
		mv /app/lint_output.xml /build/lint_output.xml; \
	fi;

.PHONY: all test lint
+3 −0
Original line number Diff line number Diff line
This directory is uploaded to the container when 'make test' is executed. Files
in this directory will be found inside /build once uploaded to the container.
Loading