diff --git a/LCU/checkhardware/check_hardware.py b/LCU/checkhardware/check_hardware.py index 745ab3b5fec793787a546f376ff2001837b32cf8..2507149d9d23bb3f4463623817e91c0881906ce9 100755 --- a/LCU/checkhardware/check_hardware.py +++ b/LCU/checkhardware/check_hardware.py @@ -48,6 +48,7 @@ import os import sys import traceback from time import sleep +import time import datetime from socket import gethostname import logging @@ -113,7 +114,28 @@ sleep(2.0) logger.debug("logger is working") # now include checkhardware library -from checkhardware_lib import * +from checkhardware_lib import read_station_config +from checkhardware_lib import swlevel +from checkhardware_lib import rspctl +from checkhardware_lib import RSP +from checkhardware_lib import check_active_boards +from checkhardware_lib import check_active_tbbdriver +from checkhardware_lib import check_active_rspdriver +from checkhardware_lib import reset_rsp_settings +from checkhardware_lib import HBA +from checkhardware_lib import reset_48_volt +from checkhardware_lib import tbbctl +from checkhardware_lib import init_lofar_lib +from checkhardware_lib import TestSettings +from checkhardware_lib import lofar +from checkhardware_lib import DB +from checkhardware_lib import is_test_mode_active +from checkhardware_lib import write_message +from checkhardware_lib import make_report +from checkhardware_lib import CoreStations +from checkhardware_lib import RemoteStations +from checkhardware_lib import LBA +from checkhardware_lib import remove_all_data_files check_version = '0516' @@ -286,7 +308,7 @@ def wait_for_start(start_datetime): while start_time > time.time(): wait_time = start_time - time.time() sleep_time = min(wait_time, 3600.0) - time.sleep(sleep_time) + sleep(sleep_time) return @@ -427,7 +449,7 @@ def wait_for_test_signal_status(status_cmd, status, retry_limit=30): return status else: logger.info('Wrong status: %s != %s. Try again...'% (out, status)) - time.sleep(1) + sleep(1) raise RuntimeError("Timed out. Last response was '%s'" % out) diff --git a/LCU/checkhardware/checkhardware_lib/spectrum_checks/peakslib.py b/LCU/checkhardware/checkhardware_lib/spectrum_checks/peakslib.py index 697a525ad2cc4d8eb60d1814371cd65d2b7abe92..b359238eae2a47990e532605a540e1465b7668f1 100644 --- a/LCU/checkhardware/checkhardware_lib/spectrum_checks/peakslib.py +++ b/LCU/checkhardware/checkhardware_lib/spectrum_checks/peakslib.py @@ -2,7 +2,7 @@ from numpy import ma, fft, power, arange, isscalar, NaN, Inf, zeros from sys import exit import logging -from checkhardware_lib.data import * +from lofar.lcu.checkhardware.checkhardware_lib.data import * logger = logging.getLogger('main.chk.pea..') logger.debug("init logger") diff --git a/LCU/checkhardware/test/t_check_hardware.py b/LCU/checkhardware/test/t_check_hardware.py index 54e5d8c78d1d8b0d5824826cb44200b0f929e1bf..3313fe014fb732b0a44745b86530777d51c8a3d9 100644 --- a/LCU/checkhardware/test/t_check_hardware.py +++ b/LCU/checkhardware/test/t_check_hardware.py @@ -9,7 +9,7 @@ import atexit import time logger = logging.getLogger(__name__) - + # mock out check for existing log directory on script import as module os.access = MagicMock(return_value=True) @@ -374,7 +374,6 @@ class TestCheckHardware(unittest.TestCase): self.assertEqual(status_cmd, expected_status_cmd) self.assertEqual(ok_status, expected_ok_status) - #@unittest.skip('disabled due to fork bomb behavior') def test_main_turns_signal_with_commands_from_settings(self): # test values @@ -387,6 +386,7 @@ class TestCheckHardware(unittest.TestCase): # todo: mock the ParameterSet instead, once the imports are resolved and this can be done straight-forward check_hardware.conf_file = r'test-check_hardware.conf' check_hardware.confpath = os.environ.get('srcdir')+'/' + check_hardware.TestSettings = TestSettings # pretend to be a station # FIXME: correct behavior of mocked-out parts should be covered by additional tests @@ -424,6 +424,4 @@ class TestCheckHardware(unittest.TestCase): if __name__ == "__main__": logger.level = logging.DEBUG - stream_handler = logging.StreamHandler(sys.stdout) - logger.addHandler(stream_handler) unittest.main()