From e95207b9c90c00991ad032070e1807e2a4759758 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 3 Nov 2021 10:03:52 +0100
Subject: [PATCH] L2SS-449: Mock DeviceProxy to avoid lofar_device trying to
 access itself as a client

---
 .../test/clients/test_attr_wrapper.py                    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py b/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
index 38ad2cce6..eb8fafb1e 100644
--- a/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
+++ b/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
@@ -13,12 +13,14 @@ from tango import DevState
 from tangostationcontrol.test.clients.test_client import test_client
 from tangostationcontrol.clients.attribute_wrapper import *
 from tangostationcontrol.devices.lofar_device import *
+import tangostationcontrol.devices.lofar_device
 
 # Test imports
 from tango.test_context import DeviceTestContext
 from tangostationcontrol.test import base
 
 import asyncio
+import mock
 
 scalar_dims = (1,)
 spectrum_dims = (4,)
@@ -38,6 +40,13 @@ def dev_init(device):
 
 
 class TestAttributeTypes(base.TestCase):
+    def setUp(self):
+        # Avoid the device trying to access itself as a client
+        self.deviceproxy_patch = mock.patch.object(tangostationcontrol.devices.lofar_device,'DeviceProxy')
+        self.deviceproxy_patch.start()
+
+    def tearDown(self):
+        self.deviceproxy_patch.stop()
 
     class str_scalar_device(lofar_device):
         scalar_R = attribute_wrapper(comms_annotation="str_scalar_R", datatype=numpy.str)
-- 
GitLab