* [PATCH] oe-selftest: Improved --list-classes when determining test names
@ 2016-01-04 12:25 Daniel Istrate
2016-01-04 13:06 ` Burton, Ross
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Istrate @ 2016-01-04 12:25 UTC (permalink / raw)
To: openembedded-core
--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@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..65d6b5e 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 hasattr(vars(t)[method], '__call__'):
print " -- --", method
except (AttributeError, ImportError) as e:
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] oe-selftest: Improved --list-classes when determining test names
2016-01-04 12:25 [PATCH] oe-selftest: Improved --list-classes when determining test names Daniel Istrate
@ 2016-01-04 13:06 ` Burton, Ross
0 siblings, 0 replies; 2+ messages in thread
From: Burton, Ross @ 2016-01-04 13:06 UTC (permalink / raw)
To: Daniel Istrate; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 273 bytes --]
On 4 January 2016 at 12:25, Daniel Istrate <
daniel.alexandrux.istrate@intel.com> wrote:
> + if method.startswith("test_") and
> hasattr(vars(t)[method], '__call__'):
>
Using callable() instead of hasattr() would be neater.
Ross
[-- Attachment #2: Type: text/html, Size: 723 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-04 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 12:25 [PATCH] oe-selftest: Improved --list-classes when determining test names Daniel Istrate
2016-01-04 13:06 ` Burton, Ross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.