Skip to content
Snippets Groups Projects
Commit 634e66c8 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-480: Mock the DeviceProxy in unit tests, as they do not work in the...

L2SS-480: Mock the DeviceProxy in unit tests, as they do not work in the DeviceTestContext and we avoid using them anyway.
parent aab40872
Branches
Tags
1 merge request!220Resolve L2SS-480 "Delays to beam weights"
......@@ -59,8 +59,6 @@ class Beam(lofar_device):
dtype=(numpy.double,), max_dim_x=96,
fget=lambda self: self._hbat_pointing_timestamp)
RECV_name = 'stat/recv/1'
# Directory where the casacore measures that we use, reside. We configure ~/.casarc to
# use the symlink /opt/IERS/current, which we switch to the actual set of files to use.
measures_directory_R = attribute(dtype=str, access=AttrWriteType.READ, fget = lambda self: get_measures_directory())
......@@ -73,13 +71,11 @@ class Beam(lofar_device):
# --------
@log_exceptions()
def configure_for_initialise(self):
# Set a reference of RECV device
try:
self.recv_proxy = DeviceProxy(self.RECV_name)
except:
logger.warning("RECV device offline") # avoid error raising in unittest
super().configure_for_initialise()
# Set a reference of RECV device
self.recv_proxy = DeviceProxy("STAT/RECV/1")
# --------
# internal functions
# --------
......
......@@ -32,6 +32,13 @@ class TestBeamDevice(base.TestCase):
self.m_init = init_patcher.start()
self.addCleanup(init_patcher.stop)
# Patch DeviceProxy to allow making the proxies during initialisation
# that we otherwise avoid using
proxy_patcher = mock.patch.object(
beam, 'DeviceProxy')
self.m_init = proxy_patcher.start()
self.addCleanup(proxy_patcher.stop)
def test_get_pointing_directions(self):
"""Verify can read pointings attribute and length matches without err"""
with DeviceTestContext(beam.Beam, process=True) as proxy:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment