summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2022-05-18 16:13:17 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-18 17:52:28 +0300
commit518f46ff0fc59743d490ae646c34fd35f4801984 (patch)
treebf1d1eb42078a6d7a15adbaac178a291aac36f82 /test
parent936864755521020618f12f9dfea78265a2e70ba4 (diff)
py: unittests: Verify that cam and cm are freed
Add checks to CameraTesterBase to verify that both the Camera and the CameraManager gets freed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/py/unittests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/py/unittests.py b/test/py/unittests.py
index 9326358d..4c214f0a 100755
--- a/test/py/unittests.py
+++ b/test/py/unittests.py
@@ -83,6 +83,9 @@ class CameraTesterBase(BaseTestCase):
self.cm = None
raise Exception('Failed to acquire camera')
+ self.wr_cam = weakref.ref(self.cam)
+ self.wr_cm = weakref.ref(self.cm)
+
def tearDown(self):
# If a test fails, the camera may be in running state. So always stop.
self.cam.stop()
@@ -94,6 +97,9 @@ class CameraTesterBase(BaseTestCase):
self.cam = None
self.cm = None
+ self.assertIsNone(self.wr_cm())
+ self.assertIsNone(self.wr_cam())
+
class AllocatorTestMethods(CameraTesterBase):
def test_allocator(self):