[PATCH] tests/functional: fix pylint false positives for cv2 module

marcandre.lureau@redhat.com posted 1 patch 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260815072421.4117291-1-marcandre.lureau@redhat.com
Maintainers: Thomas Huth <th.huth+qemu@posteo.eu>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, "Daniel P. Berrangé" <berrange@redhat.com>
tests/functional/pylintrc | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by marcandre.lureau@redhat.com 1 week, 4 days ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Add generated-members=cv2.* to pylintrc so pylint skips member
checking on the cv2 C extension module, whose members are not
visible to static analysis.

Silence:
2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"

Note: I also tried with extension-pkg-allow-list, but that didn't work
for some reason.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/functional/pylintrc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
index 949bea611fe4..373aabd6ca3f 100644
--- a/tests/functional/pylintrc
+++ b/tests/functional/pylintrc
@@ -79,6 +79,12 @@ disable=bad-inline-option,
         useless-suppression,
 
 
+[TYPECHECK]
+
+# cv2 is a C extension module whose members are not visible to pylint
+generated-members=cv2.*
+
+
 [SIMILARITIES]
 
 # Minimum lines number of a similarity.
-- 
2.55.0.543.g5ebe2ebe4ea8


Re: [PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by Thomas Huth 1 week, 2 days ago
On 15/08/2026 09.24, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Add generated-members=cv2.* to pylintrc so pylint skips member
> checking on the cv2 C extension module, whose members are not
> visible to static analysis.
>
> Silence:
> 2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
> 2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"

Alex recently already sent a patch for that error here:

  https://gitlab.com/qemu-project/qemu/-/commit/dd14a21b9dc1

Didn't that help to silence the message in your case, too?

  Thomas



> Note: I also tried with extension-pkg-allow-list, but that didn't work
> for some reason.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   tests/functional/pylintrc | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
> index 949bea611fe4..373aabd6ca3f 100644
> --- a/tests/functional/pylintrc
> +++ b/tests/functional/pylintrc
> @@ -79,6 +79,12 @@ disable=bad-inline-option,
>           useless-suppression,
>   
>   
> +[TYPECHECK]
> +
> +# cv2 is a C extension module whose members are not visible to pylint
> +generated-members=cv2.*
> +
> +
>   [SIMILARITIES]
>   
>   # Minimum lines number of a similarity.


Re: [PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by Marc-André Lureau 1 week, 2 days ago
Hi

On Mon, Aug 17, 2026 at 11:19 AM Thomas Huth <thuth@redhat.com> wrote:
>
> On 15/08/2026 09.24, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Add generated-members=cv2.* to pylintrc so pylint skips member
> > checking on the cv2 C extension module, whose members are not
> > visible to static analysis.
> >
> > Silence:
> > 2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
> > 2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"
>
> Alex recently already sent a patch for that error here:
>
>   https://gitlab.com/qemu-project/qemu/-/commit/dd14a21b9dc1
>
> Didn't that help to silence the message in your case, too?

Ah I missed that, but it doesn't help:

pylint --rcfile ../tests/functional/pylintrc ../tests/functional/arm/
************* Module test_integratorcp
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:83:25:
E1101: Module 'cv2' has no 'imread' member (no-member)
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:26:
E1101: Module 'cv2' has no 'cvtColor' member (no-member)
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:55:
E1101: Module 'cv2' has no 'COLOR_BGR2GRAY' member (no-member)
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:17:
E1101: Module 'cv2' has no 'matchTemplate' member (no-member)
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:52:
E1101: Module 'cv2' has no 'imread' member (no-member)
/home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:86:35:
E1101: Module 'cv2' has no 'TM_CCOEFF_NORMED' member (no-member)

My understanding:

I1101 (c-extension-no-member) - disable: silence if pylint can't
introspect the module

E1101 (no-member) - but we need to tell pylint to trust any member
access on cv2 if it can

>
>   Thomas
>
>
>
> > Note: I also tried with extension-pkg-allow-list, but that didn't work
> > for some reason.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   tests/functional/pylintrc | 6 ++++++
> >   1 file changed, 6 insertions(+)
> >
> > diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
> > index 949bea611fe4..373aabd6ca3f 100644
> > --- a/tests/functional/pylintrc
> > +++ b/tests/functional/pylintrc
> > @@ -79,6 +79,12 @@ disable=bad-inline-option,
> >           useless-suppression,
> >
> >
> > +[TYPECHECK]
> > +
> > +# cv2 is a C extension module whose members are not visible to pylint
> > +generated-members=cv2.*
> > +
> > +
> >   [SIMILARITIES]
> >
> >   # Minimum lines number of a similarity.
>
Re: [PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by Thomas Huth 1 week, 2 days ago
On 17/08/2026 09.57, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Aug 17, 2026 at 11:19 AM Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 15/08/2026 09.24, marcandre.lureau@redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>
>>> Add generated-members=cv2.* to pylintrc so pylint skips member
>>> checking on the cv2 C extension module, whose members are not
>>> visible to static analysis.
>>>
>>> Silence:
>>> 2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
>>> 2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"
>>
>> Alex recently already sent a patch for that error here:
>>
>>    https://gitlab.com/qemu-project/qemu/-/commit/dd14a21b9dc1
>>
>> Didn't that help to silence the message in your case, too?
> 
> Ah I missed that, but it doesn't help:
> 
> pylint --rcfile ../tests/functional/pylintrc ../tests/functional/arm/
> ************* Module test_integratorcp
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:83:25:
> E1101: Module 'cv2' has no 'imread' member (no-member)
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:26:
> E1101: Module 'cv2' has no 'cvtColor' member (no-member)
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:55:
> E1101: Module 'cv2' has no 'COLOR_BGR2GRAY' member (no-member)
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:17:
> E1101: Module 'cv2' has no 'matchTemplate' member (no-member)
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:52:
> E1101: Module 'cv2' has no 'imread' member (no-member)
> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:86:35:
> E1101: Module 'cv2' has no 'TM_CCOEFF_NORMED' member (no-member)
> 
> My understanding:
> 
> I1101 (c-extension-no-member) - disable: silence if pylint can't
> introspect the module
> 
> E1101 (no-member) - but we need to tell pylint to trust any member
> access on cv2 if it can
Ok, but could you then add it to the "disable=..." list instead, so that we 
disable this for all other modules, too? ... otherwise we'll be busy adding 
an entry for all other modules where this pops up in the course of time.

  Thanks,
   Thomas


Re: [PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by Marc-André Lureau 1 week, 2 days ago
Hi

On Mon, Aug 17, 2026 at 12:39 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 17/08/2026 09.57, Marc-André Lureau wrote:
> > Hi
> >
> > On Mon, Aug 17, 2026 at 11:19 AM Thomas Huth <thuth@redhat.com> wrote:
> >>
> >> On 15/08/2026 09.24, marcandre.lureau@redhat.com wrote:
> >>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >>>
> >>> Add generated-members=cv2.* to pylintrc so pylint skips member
> >>> checking on the cv2 C extension module, whose members are not
> >>> visible to static analysis.
> >>>
> >>> Silence:
> >>> 2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
> >>> 2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"
> >>
> >> Alex recently already sent a patch for that error here:
> >>
> >>    https://gitlab.com/qemu-project/qemu/-/commit/dd14a21b9dc1
> >>
> >> Didn't that help to silence the message in your case, too?
> >
> > Ah I missed that, but it doesn't help:
> >
> > pylint --rcfile ../tests/functional/pylintrc ../tests/functional/arm/
> > ************* Module test_integratorcp
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:83:25:
> > E1101: Module 'cv2' has no 'imread' member (no-member)
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:26:
> > E1101: Module 'cv2' has no 'cvtColor' member (no-member)
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:55:
> > E1101: Module 'cv2' has no 'COLOR_BGR2GRAY' member (no-member)
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:17:
> > E1101: Module 'cv2' has no 'matchTemplate' member (no-member)
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:52:
> > E1101: Module 'cv2' has no 'imread' member (no-member)
> > /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:86:35:
> > E1101: Module 'cv2' has no 'TM_CCOEFF_NORMED' member (no-member)
> >
> > My understanding:
> >
> > I1101 (c-extension-no-member) - disable: silence if pylint can't
> > introspect the module
> >
> > E1101 (no-member) - but we need to tell pylint to trust any member
> > access on cv2 if it can
> Ok, but could you then add it to the "disable=..." list instead, so that we
> disable this for all other modules, too? ... otherwise we'll be busy adding
> an entry for all other modules where this pops up in the course of time.
>

I see your point, but disabling "no-member" globally means pylint
won't catch typos like self.naem or obj.nonexistent_method() anywhere.
Re: [PATCH] tests/functional: fix pylint false positives for cv2 module
Posted by Thomas Huth 1 week, 2 days ago
On 17/08/2026 12.54, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Aug 17, 2026 at 12:39 PM Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 17/08/2026 09.57, Marc-André Lureau wrote:
>>> Hi
>>>
>>> On Mon, Aug 17, 2026 at 11:19 AM Thomas Huth <thuth@redhat.com> wrote:
>>>>
>>>> On 15/08/2026 09.24, marcandre.lureau@redhat.com wrote:
>>>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>>>
>>>>> Add generated-members=cv2.* to pylintrc so pylint skips member
>>>>> checking on the cv2 C extension module, whose members are not
>>>>> visible to static analysis.
>>>>>
>>>>> Silence:
>>>>> 2026-08-15 10:42:08,710 - INFO: qemu-test.test_pylint Checking files in /home/elmarco/src/qemu.qom-qapi/tests/functional/arm with pylint
>>>>> 2026-08-15 10:42:10,941 - ERROR: qemu-test.test_pylint "/home/elmarco/src/qemu.qom-qapi/tests/functional/arm/test_integratorcp.py:83: E1101: Module 'cv2' has no 'imread' member (no-member)"
>>>>
>>>> Alex recently already sent a patch for that error here:
>>>>
>>>>     https://gitlab.com/qemu-project/qemu/-/commit/dd14a21b9dc1
>>>>
>>>> Didn't that help to silence the message in your case, too?
>>>
>>> Ah I missed that, but it doesn't help:
>>>
>>> pylint --rcfile ../tests/functional/pylintrc ../tests/functional/arm/
>>> ************* Module test_integratorcp
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:83:25:
>>> E1101: Module 'cv2' has no 'imread' member (no-member)
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:26:
>>> E1101: Module 'cv2' has no 'cvtColor' member (no-member)
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:84:55:
>>> E1101: Module 'cv2' has no 'COLOR_BGR2GRAY' member (no-member)
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:17:
>>> E1101: Module 'cv2' has no 'matchTemplate' member (no-member)
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:85:52:
>>> E1101: Module 'cv2' has no 'imread' member (no-member)
>>> /home/elmarco/src/qemu.nohmp/tests/functional/arm/test_integratorcp.py:86:35:
>>> E1101: Module 'cv2' has no 'TM_CCOEFF_NORMED' member (no-member)
>>>
>>> My understanding:
>>>
>>> I1101 (c-extension-no-member) - disable: silence if pylint can't
>>> introspect the module
>>>
>>> E1101 (no-member) - but we need to tell pylint to trust any member
>>> access on cv2 if it can
>> Ok, but could you then add it to the "disable=..." list instead, so that we
>> disable this for all other modules, too? ... otherwise we'll be busy adding
>> an entry for all other modules where this pops up in the course of time.
>>
> 
> I see your point, but disabling "no-member" globally means pylint
> won't catch typos like self.naem or obj.nonexistent_method() anywhere.
Ok, then let's go with your patch here.

Reviewed-by: Thomas Huth <thuth@redhat.com>