summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/tests/test_data.py
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-11-09 11:26:59 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:03:53 +0000
commit7d7d0dc3736fc12ae7848de2785f0066e6470cd1 (patch)
tree75ce289509c144145be42cb58f4b7a62f602a535 /meta/lib/oeqa/core/tests/test_data.py
parent7dc519d20e835ee7693c31903e164c4bc0e5e598 (diff)
downloadopenembedded-core-contrib-7d7d0dc3736fc12ae7848de2785f0066e6470cd1.tar.gz
oeqa/core: Add tests for the OEQA framework
This test suite covers the current functionality for the OEQA framework. For run certain test suite, $ cd meta/lib/oeqa/core/tests $ ./test_data.py Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Diffstat (limited to 'meta/lib/oeqa/core/tests/test_data.py')
-rwxr-xr-xmeta/lib/oeqa/core/tests/test_data.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/tests/test_data.py b/meta/lib/oeqa/core/tests/test_data.py
new file mode 100755
index 0000000000..320468cbe4
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/test_data.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import unittest
+import logging
+import os
+
+from common import setup_sys_path, TestBase
+setup_sys_path()
+
+from oeqa.core.exception import OEQAMissingVariable
+from oeqa.core.utils.test import getCaseMethod, getSuiteCasesNames
+
+class TestData(TestBase):
+ modules = ['data']
+
+ def test_data_fail_missing_variable(self):
+ expectedException = "oeqa.core.exception.OEQAMissingVariable"
+
+ tc = self._testLoader(modules=self.modules)
+ self.assertEqual(False, tc.runTests().wasSuccessful())
+ for test, data in tc._results['errors']:
+ expect = False
+ if expectedException in data:
+ expect = True
+
+ self.assertTrue(expect)
+
+ def test_data_fail_wrong_variable(self):
+ expectedError = 'AssertionError'
+ d = {'IMAGE' : 'core-image-sato', 'ARCH' : 'arm'}
+
+ tc = self._testLoader(d=d, modules=self.modules)
+ self.assertEqual(False, tc.runTests().wasSuccessful())
+ for test, data in tc._results['failures']:
+ expect = False
+ if expectedError in data:
+ expect = True
+
+ self.assertTrue(expect)
+
+ def test_data_ok(self):
+ d = {'IMAGE' : 'core-image-minimal', 'ARCH' : 'x86', 'MACHINE' : 'qemuarm'}
+
+ tc = self._testLoader(d=d, modules=self.modules)
+ self.assertEqual(True, tc.runTests().wasSuccessful())
+
+if __name__ == '__main__':
+ unittest.main()