From 9d475cc692db7319784fe0fecca031507ac98378 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 3 Nov 2021 13:25:59 +0000
Subject: [PATCH] L2SS-449: Use addCleanup instead of tearDown to make setUp
 composable and exception safe.

---
 .../tangostationcontrol/test/clients/test_attr_wrapper.py    | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py b/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
index eb8fafb1e..da2130deb 100644
--- a/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
+++ b/tangostationcontrol/tangostationcontrol/test/clients/test_attr_wrapper.py
@@ -43,10 +43,7 @@ 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()
+        self.addCleanup(self.deviceproxy_patch.stop)
 
     class str_scalar_device(lofar_device):
         scalar_R = attribute_wrapper(comms_annotation="str_scalar_R", datatype=numpy.str)
-- 
GitLab