[OE-core] [PATCH 1/1] selftest/seltest.py: Add test to check imports from other layers

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Tue Jul 12 13:09:47 UTC 2016


From: Mariano Lopez <mariano.lopez at linux.intel.com>

This tests adds a check of selftest itself to verify if can
add test from other layers.

[YOCTO #9770]

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 meta-selftest/lib/oeqa/selftest/imported.py | 14 ++++++++++++++
 meta/lib/oeqa/selftest/seltest.py           | 19 +++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 meta-selftest/lib/oeqa/selftest/imported.py
 create mode 100644 meta/lib/oeqa/selftest/seltest.py

diff --git a/meta-selftest/lib/oeqa/selftest/imported.py b/meta-selftest/lib/oeqa/selftest/imported.py
new file mode 100644
index 0000000..b80150b
--- /dev/null
+++ b/meta-selftest/lib/oeqa/selftest/imported.py
@@ -0,0 +1,14 @@
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.decorators import testcase
+
+class ImportedTests(oeSelfTest):
+
+    def test_import_dummy(self):
+        """
+        Summary: Doesn't check anything, used to check import test from other layers.
+        Expected: 1. Pass unconditionally
+        Product: oe-core
+        Author: Mariano Lopez <mariano.lopez at intel.comr
+        """
+
+        self.assertEqual(True, True, msg = "Impossible to fail this test")
diff --git a/meta/lib/oeqa/selftest/seltest.py b/meta/lib/oeqa/selftest/seltest.py
new file mode 100644
index 0000000..ea185ec
--- /dev/null
+++ b/meta/lib/oeqa/selftest/seltest.py
@@ -0,0 +1,19 @@
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import runCmd
+from oeqa.utils.decorators import testcase
+
+class Selftest(oeSelfTest):
+
+    def test_import_test_from_layer(self):
+        """
+        Summary: Checks functionality to import tests from other layers.
+        Expected: 1. Must show "test_import_dummy" in the test list.
+        Product: oe-core
+        Author: Mariano Lopez <mariano.lopez at intel.com>
+        """
+
+        test_name = "imported.ImportedTests.test_import_dummy"
+        error_msg = "Couldn't find test: %s; Not importing tests from other layers" % test_name
+        result = runCmd("oe-selftest --list-tests")
+        success = True if test_name in result.output else False
+        self.assertEqual(success, True, msg = error_msg)
-- 
2.6.6




More information about the Openembedded-core mailing list