Skip to contentSkip to conversation

tests/functional: allow pylint to introspect cv2

RFC PATCH In review Alex Bennée 2 participants 5 messages Jun 11 – Jun 12

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tests/functional: allow pylint to introspect cv2

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.

---
 tests/functional/pylintrc | 2 ++
 1 file changed, 2 insertions(+)
tests/functional/pylintrc +2 -0
index 049c3e76f12..c4c5237aa9d 100644
@@ -82,3 +82,5 @@ disable=bad-inline-option,
 
 # Minimum lines number of a similarity.
 min-similarity-lines=20
+
+extension-pkg-allow-list = cv2
Signature · 1 line
2.47.3
#1 lore raw
Quoted 3 lines · Alex Bennée

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

Quoted 18 lines

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

---
  tests/functional/pylintrc | 2 ++
  1 file changed, 2 insertions(+)
tests/functional/pylintrc +2 -0
index 049c3e76f12..c4c5237aa9d 100644
@@ -82,3 +82,5 @@ disable=bad-inline-option,
 
  # Minimum lines number of a similarity.
  min-similarity-lines=20
+
+extension-pkg-allow-list = cv2
#2 lore raw
Quoted 11 lines · Thomas Huth
Quoted 7 lines · Alex Bennée

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 <[email protected]>
  Architecture: all
  Version: 3.3.4-1
Quoted 19 lines

Thomas

Quoted 15 lines

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

---
  tests/functional/pylintrc | 2 ++
  1 file changed, 2 insertions(+)
tests/functional/pylintrc +2 -0
index 049c3e76f12..c4c5237aa9d 100644
@@ -82,3 +82,5 @@ disable=bad-inline-option,
    # Minimum lines number of a similarity.
  min-similarity-lines=20
+
+extension-pkg-allow-list = cv2
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#3 lore raw
Quoted 14 lines · Alex Bennée
Quoted 11 lines · Thomas Huth
Quoted 7 lines · Alex Bennée

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)...

Quoted 9 lines
   dpkg --status pylint
   Package: pylint
   Status: install ok installed
   Priority: optional
   Section: python
   Installed-Size: 2073
   Maintainer: Debian Python Team <[email protected]>
   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

#4 lore raw
Quoted 24 lines · Thomas Huth
Quoted 13 lines · Alex Bennée
Quoted 11 lines · Thomas Huth
Quoted 7 lines · Alex Bennée

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)...

Quoted 9 lines

dpkg --status pylint
Package: pylint
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 2073
Maintainer: Debian Python Team <[email protected]>
Architecture: all
Version: 3.3.4-1

Quoted 6 lines

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.

Quoted 3 lines

Thanks,
Thomas

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro