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>
This commit is contained in:
parent
9368647555
commit
518f46ff0f
1 changed files with 6 additions and 0 deletions
|
@ -83,6 +83,9 @@ class CameraTesterBase(BaseTestCase):
|
||||||
self.cm = None
|
self.cm = None
|
||||||
raise Exception('Failed to acquire camera')
|
raise Exception('Failed to acquire camera')
|
||||||
|
|
||||||
|
self.wr_cam = weakref.ref(self.cam)
|
||||||
|
self.wr_cm = weakref.ref(self.cm)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# If a test fails, the camera may be in running state. So always stop.
|
# If a test fails, the camera may be in running state. So always stop.
|
||||||
self.cam.stop()
|
self.cam.stop()
|
||||||
|
@ -94,6 +97,9 @@ class CameraTesterBase(BaseTestCase):
|
||||||
self.cam = None
|
self.cam = None
|
||||||
self.cm = None
|
self.cm = None
|
||||||
|
|
||||||
|
self.assertIsNone(self.wr_cm())
|
||||||
|
self.assertIsNone(self.wr_cam())
|
||||||
|
|
||||||
|
|
||||||
class AllocatorTestMethods(CameraTesterBase):
|
class AllocatorTestMethods(CameraTesterBase):
|
||||||
def test_allocator(self):
|
def test_allocator(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue