diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index badf33f0d073c001e0e1616b21296912954af4be..8d2e2c7cdd208fd6f9fcc07228c37190cf3b0a91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -527,7 +527,8 @@ xenon: shellcheck: stage: static-analysis script: -# TODO(Corne): Ignore shell files in submodules +# TODO(Corne): L2SS-962: Ignore shell files in submodules + - shellcheck --version - shellcheck **/*.sh sphinx-documentation: stage: documentation diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py index 185059d7dedf1ac0218170bc5ec2180032011da1..dfb548d3ed0b8d51edab43d2c74b280cf40c0162 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py @@ -184,7 +184,7 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase): # Test RECV attributes self.assertEqual(stat.rcu_attenuator_dB, None) self.assertEqual(stat.rcu_band_select, None) - self.assertEqual(stat.rcu_dth_on, None) + self.assertEqual(stat.rcu_dth_on, None) def test_SST_statistics_with_device_in_off(self): self.setup_recv_proxy() diff --git a/tangostationcontrol/tangostationcontrol/statistics/reader.py b/tangostationcontrol/tangostationcontrol/statistics/reader.py index 983c59b8df3b361158f8a448e17768dbf0663128..1ab326db03bf8fdb1b773ce3471cb0ddbe287846 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/reader.py +++ b/tangostationcontrol/tangostationcontrol/statistics/reader.py @@ -161,7 +161,7 @@ class statistics_data: "source_info_fsub_type", "source_info_beam_repositioning_flag", "source_info_antenna_band_index", "source_info__raw", "observation_id", "nof_statistics_per_packet", "nof_signal_inputs", "nof_bytes_per_statistic", "marker", "integration_interval_raw", "integration_interval", "data_id__raw", "block_serial_number", "block_period_raw", "block_period", "data_id_signal_input_index", - "data_id_subband_index", "data_id_first_baseline", "data_id_beamlet_index", "nof_valid_payloads", "nof_payload_errors", "values", + "data_id_subband_index", "data_id_first_baseline", "data_id_beamlet_index", "nof_valid_payloads", "nof_payload_errors", "values", "rcu_attenuator_dB", "rcu_band_select", "rcu_dth_on") def __init__(self, file, group_key): @@ -203,6 +203,7 @@ class statistics_data: # get SST specific stuff if self.marker == "S": self.data_id_signal_input_index = file[group_key].attrs["data_id_signal_input_index"] + # check if the dataset is empty or not. if empty, set to None, if not get the value attribute_names = ["rcu_attenuator_dB", "rcu_band_select", "rcu_dth_on"] for a in attribute_names: if file[group_key].attrs[a].shape is None: diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py index 58b250f667f3313b60287364016cd6f654f3a3a1..ee94f3dc2fba53930d91f4907bcd9320d0fe1a0c 100644 --- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py +++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py @@ -338,10 +338,10 @@ class SstHdf5Writer(HDF5Writer): attribute_names = ["rcu_attenuator_dB", "rcu_band_select", "rcu_dth_on"] attribute_types = {"rcu_attenuator_dB": numpy.int64, "rcu_band_select" : numpy.int64, "rcu_dth_on" : bool} for a in attribute_names: - if self.current_matrix.parameters[a] is None: - self.device_attributes[a] = h5py.Empty("f") - else: + try: self.device_attributes[a] = self.current_matrix.parameters[a].astype(attribute_types[a]) + except AttributeError: + self.device_attributes[a] = h5py.Empty("f") for k,v in self.device_attributes.items(): current_group.attrs[k] = v diff --git a/tangostationcontrol/tox.ini b/tangostationcontrol/tox.ini index 1431b618acbd0dcb0b3dfbdb412bf874c811ac2d..52d27b6eae221651e0c526a3e09552cb6129168e 100644 --- a/tangostationcontrol/tox.ini +++ b/tangostationcontrol/tox.ini @@ -24,7 +24,11 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt -r{toxinidir}/test-requirements.txt -commands = {envpython} -m stestr run {posargs} +commands_pre = + {envpython} --version +commands = + {envpython} -m stestr --version + {envpython} -m stestr run {posargs} [testenv:integration] ; Warning running integration tests will make changes to your docker system! @@ -37,6 +41,8 @@ setenv = PYTHON={envpython} -m coverage run --source tangostationcontrol --parallel-mode commands = echo "Integration test directory configured for{env:TESTS_DIR} ({env:TEST_MODULE:default})" + {envpython} -m stestr --version + {envpython} -m coverage --version {envpython} -m stestr run --serial {posargs} {envpython} -m coverage combine {envpython} -m coverage html --omit='*test*' -d cover @@ -54,16 +60,20 @@ deps = -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt -r{toxinidir}/test-requirements.txt commands = - {envpython} -m coverage erase - {envpython} -m stestr run {posargs} - {envpython} -m coverage combine - {envpython} -m coverage html --omit='*test*' -d cover - {envpython} -m coverage xml -o coverage.xml - {envpython} -m coverage report --omit='*test*' + {envpython} -m stestr --version + {envpython} -m coverage --version + {envpython} -m coverage erase + {envpython} -m stestr run {posargs} + {envpython} -m coverage combine + {envpython} -m coverage html --omit='*test*' -d cover + {envpython} -m coverage xml -o coverage.xml + {envpython} -m coverage report --omit='*test*' ; TODO(Corne): Integrate Hacking to customize pep8 rules [testenv:pep8] commands = + {envpython} -m doc8 --version + {envpython} -m flake8 --version {envpython} -m doc8 docs/source/ --ignore D001 {envpython} -m flake8 @@ -73,18 +83,21 @@ commands = ; It thus matters what interfaces Docker will bind our ; containers to, not what our containers listen on. commands = + {envpython} -m bandit --version {envpython} -m bandit -r devices/ -n5 -ll -s B104 [testenv:xenon]; commands = - {envpython} -m xenon tangostationcontrol -b B -m A -a A -i libhdbpp-python + {envpython} -m xenon --version + {envpython} -m xenon tangostationcontrol -b B -m A -a A -i libhdbpp-python [testenv:docs] deps = -r{toxinidir}/../docker-compose/lofar-device-base/lofar-requirements.txt -r{toxinidir}/docs/docs-requirements.txt commands = - sphinx-build -W -b html docs/source docs/build/html + sphinx-build --version + sphinx-build -W -b html docs/source docs/build/html [flake8] filename = *.py,.stestr.conf,.txt