[OE-core] [PATCHv2] oe-selftest: Improved --list-classes when determining test names
Istrate, Daniel AlexandruX
daniel.alexandrux.istrate at intel.com
Mon Jan 4 13:45:44 UTC 2016
Used callable() instead of hasattr().
-----Original Message-----
From: Istrate, Daniel AlexandruX
Sent: Monday, January 4, 2016 15:44
To: openembedded-core at lists.openembedded.org
Cc: Istrate, Daniel AlexandruX <daniel.alexandrux.istrate at intel.com>
Subject: [PATCHv2] oe-selftest: Improved --list-classes when determining test names
--list-classes does a weak validation when determining test names:
(if method.startswith("test_") which could report any class attribute that starts with 'test_' as a valid test case.
This fix checks that the class attribute that starts with 'test_'
is also callable (is a method).
Fix for [YOCTO #8862]
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
---
scripts/oe-selftest | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index 08a5af3..1aee057 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -404,7 +404,7 @@ def main():
if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest:
print " --", v
for method in dir(t):
- if method.startswith("test_"):
+ if method.startswith("test_") and callable(vars(t)[method]):
print " -- --", method
except (AttributeError, ImportError) as e:
--
2.1.0
More information about the Openembedded-core
mailing list