[RFC PATCH] tests/functional: allow pylint to introspect cv2

Alex Bennée posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260611162536.2184620-1-alex.bennee@linaro.org
Maintainers: Thomas Huth <th.huth+qemu@posteo.eu>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, "Daniel P. Berrangé" <berrange@redhat.com>
tests/functional/pylintrc | 2 ++
1 file changed, 2 insertions(+)
[RFC PATCH] tests/functional: allow pylint to introspect cv2
Posted by Alex Bennée 1 month, 2 weeks ago
To fix:

  qemu-test.test_pylint "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83: I1101: Module 'cv2' has no 'imread' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)"

Manually running python3 showed I could indeed import cv2 and call
those functions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/functional/pylintrc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
index 049c3e76f12..c4c5237aa9d 100644
--- a/tests/functional/pylintrc
+++ b/tests/functional/pylintrc
@@ -82,3 +82,5 @@ disable=bad-inline-option,
 
 # Minimum lines number of a similarity.
 min-similarity-lines=20
+
+extension-pkg-allow-list = cv2
-- 
2.47.3


Re: [RFC PATCH] tests/functional: allow pylint to introspect cv2
Posted by Thomas Huth 1 month, 2 weeks ago
On 11/06/2026 18.25, Alex Bennée wrote:
> To fix:
> 
>    qemu-test.test_pylint "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83: I1101: Module 'cv2' has no 'imread' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)"

Which pylint version are you using? I don't get this with my pylint here 
(version 4.0.4)...

  Thomas


> Manually running python3 showed I could indeed import cv2 and call
> those functions.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   tests/functional/pylintrc | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
> index 049c3e76f12..c4c5237aa9d 100644
> --- a/tests/functional/pylintrc
> +++ b/tests/functional/pylintrc
> @@ -82,3 +82,5 @@ disable=bad-inline-option,
>   
>   # Minimum lines number of a similarity.
>   min-similarity-lines=20
> +
> +extension-pkg-allow-list = cv2


Re: [RFC PATCH] tests/functional: allow pylint to introspect cv2
Posted by Alex Bennée 1 month, 2 weeks ago
Thomas Huth <thuth@redhat.com> writes:

> On 11/06/2026 18.25, Alex Bennée wrote:
>> To fix:
>>    qemu-test.test_pylint
>> "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83:
>> I1101: Module 'cv2' has no 'imread' member, but source is
>> unavailable. Consider adding this module to extension-pkg-allow-list
>> if you want to perform analysis based on run-time introspection of
>> living objects. (c-extension-no-member)"
>
> Which pylint version are you using? I don't get this with my pylint
> here (version 4.0.4)...

  dpkg --status pylint
  Package: pylint
  Status: install ok installed
  Priority: optional
  Section: python
  Installed-Size: 2073
  Maintainer: Debian Python Team <team+python@tracker.debian.org>
  Architecture: all
  Version: 3.3.4-1

>
>  Thomas
>
>
>> Manually running python3 showed I could indeed import cv2 and call
>> those functions.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   tests/functional/pylintrc | 2 ++
>>   1 file changed, 2 insertions(+)
>> diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
>> index 049c3e76f12..c4c5237aa9d 100644
>> --- a/tests/functional/pylintrc
>> +++ b/tests/functional/pylintrc
>> @@ -82,3 +82,5 @@ disable=bad-inline-option,
>>     # Minimum lines number of a similarity.
>>   min-similarity-lines=20
>> +
>> +extension-pkg-allow-list = cv2

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [RFC PATCH] tests/functional: allow pylint to introspect cv2
Posted by Thomas Huth 1 month, 2 weeks ago
On 11/06/2026 21.05, Alex Bennée wrote:
> Thomas Huth <thuth@redhat.com> writes:
> 
>> On 11/06/2026 18.25, Alex Bennée wrote:
>>> To fix:
>>>     qemu-test.test_pylint
>>> "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83:
>>> I1101: Module 'cv2' has no 'imread' member, but source is
>>> unavailable. Consider adding this module to extension-pkg-allow-list
>>> if you want to perform analysis based on run-time introspection of
>>> living objects. (c-extension-no-member)"
>>
>> Which pylint version are you using? I don't get this with my pylint
>> here (version 4.0.4)...
> 
>    dpkg --status pylint
>    Package: pylint
>    Status: install ok installed
>    Priority: optional
>    Section: python
>    Installed-Size: 2073
>    Maintainer: Debian Python Team <team+python@tracker.debian.org>
>    Architecture: all
>    Version: 3.3.4-1

Ok ... thinking about it, I think it would be better to rather add 
"c-extension-no-member" to the "disable" list in our pylintrc instead, 
otherwise this will likely pop up in other spots as well and then we have to 
constantly extend the list each time which sounds cumbersome. Could you 
please try whether adding "c-extension-no-member" to the disable=... section 
silences the warning for you?

  Thanks,
   Thomas


Re: [RFC PATCH] tests/functional: allow pylint to introspect cv2
Posted by Alex Bennée 1 month, 2 weeks ago
Thomas Huth <thuth@redhat.com> writes:

> On 11/06/2026 21.05, Alex Bennée wrote:
>> Thomas Huth <thuth@redhat.com> writes:
>> 
>>> On 11/06/2026 18.25, Alex Bennée wrote:
>>>> To fix:
>>>>     qemu-test.test_pylint
>>>> "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83:
>>>> I1101: Module 'cv2' has no 'imread' member, but source is
>>>> unavailable. Consider adding this module to extension-pkg-allow-list
>>>> if you want to perform analysis based on run-time introspection of
>>>> living objects. (c-extension-no-member)"
>>>
>>> Which pylint version are you using? I don't get this with my pylint
>>> here (version 4.0.4)...
>>    dpkg --status pylint
>>    Package: pylint
>>    Status: install ok installed
>>    Priority: optional
>>    Section: python
>>    Installed-Size: 2073
>>    Maintainer: Debian Python Team <team+python@tracker.debian.org>
>>    Architecture: all
>>    Version: 3.3.4-1
>
> Ok ... thinking about it, I think it would be better to rather add
> "c-extension-no-member" to the "disable" list in our pylintrc instead,
> otherwise this will likely pop up in other spots as well and then we
> have to constantly extend the list each time which sounds cumbersome.
> Could you please try whether adding "c-extension-no-member" to the
> disable=... section silences the warning for you?

That also works, I will respin.

>
>  Thanks,
>   Thomas

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro