From patchwork Wed May 18 13:13:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15957 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E375CC326E for ; Wed, 18 May 2022 13:14:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 674DA65671; Wed, 18 May 2022 15:13:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652879639; bh=2Gh0dNLUngxfQES1Wrqv7GwQjtiauyJZZwFH21iSIM0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B5y2nZeN06WF2m/QzN2bKcSJm8Vj0QJBHCNM5DgLRZtkltjuBlQJiUlgNZD8/NG4Q aR9FcCFXXHSRzZnFXvn3bp/Sn2wkygmKLuQwk6uSkLqUAxpkzGt2HOBDrc7zMJBZjf xNBEz8tUu5PywIyi7yFPzSDq2UqEiWQzO1tdQUn6B6cFkFFaZM28FQoFIv6zYhHUxd C+iR/ETBEm8QCYJa3DTUjQY1w6n6eYvGx2QrKJnCehsb7wSngw8ugyLzMjw+y/4dDn 80Pbz5ZH0nr78k+gVj+mExcLHKi/shICRo27QGaI513O/cyerP2rsItvHqYk85cJD6 C3uB5kEhCemWA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 060AA65662 for ; Wed, 18 May 2022 15:13:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lBnAv0C4"; dkim-atps=neutral Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 672DB1C19; Wed, 18 May 2022 15:13:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652879629; bh=2Gh0dNLUngxfQES1Wrqv7GwQjtiauyJZZwFH21iSIM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBnAv0C4Nf/3wQYb9gUe6tKcQhRfFKtviDeiS0dkKOTTdimAati1p93YGU9FJ67IO ltr2SCF43IouZlQxz4QqweAGEaUKSqXn7aKVmZpQm4vy79a/P6/3mn7tmFqs7JLXcD f01YBCtVZKKJKsv2HG5V0cEpf9EFgUM4pnXZ4O5I= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Wed, 18 May 2022 16:13:18 +0300 Message-Id: <20220518131329.66994-8-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220518131329.66994-1-tomi.valkeinen@ideasonboard.com> References: <20220518131329.66994-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 07/18] py: unittests: make typechecker happy X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add some annotations and self.assertIsNotNone() calls to remove the typechecker warnings. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- test/py/unittests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/py/unittests.py b/test/py/unittests.py index 4c214f0a..7dede33b 100755 --- a/test/py/unittests.py +++ b/test/py/unittests.py @@ -10,6 +10,7 @@ import libcamera as libcam import os import selectors import time +import typing import unittest import weakref @@ -70,6 +71,9 @@ class SimpleTestMethods(BaseTestCase): class CameraTesterBase(BaseTestCase): + cm: typing.Any + cam: typing.Any + def setUp(self): self.cm = libcam.CameraManager.singleton() self.cam = next((cam for cam in self.cm.cameras if 'platform/vimc' in cam.id), None) @@ -131,6 +135,7 @@ class AllocatorTestMethods(CameraTesterBase): wr_allocator = weakref.ref(allocator) buffers = allocator.buffers(stream) + self.assertIsNotNone(buffers) buffers = None buffer = allocator.buffers(stream)[0] @@ -166,6 +171,8 @@ class SimpleCaptureMethods(CameraTesterBase): streamconfig = camconfig.at(0) fmts = streamconfig.formats + self.assertIsNotNone(fmts) + fmts = None ret = cam.configure(camconfig) self.assertZero(ret) @@ -225,6 +232,8 @@ class SimpleCaptureMethods(CameraTesterBase): streamconfig = camconfig.at(0) fmts = streamconfig.formats + self.assertIsNotNone(fmts) + fmts = None ret = cam.configure(camconfig) self.assertZero(ret) @@ -348,9 +357,9 @@ if __name__ == '__main__': gc.unfreeze() gc.collect() - obs_after = get_all_objects([obs_before]) + obs_after = get_all_objects([obs_before]) # type: ignore - before = create_type_count_map(obs_before) + before = create_type_count_map(obs_before) # type: ignore after = create_type_count_map(obs_after) leaks = diff_type_count_maps(before, after)