diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-11-09 11:26:59 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:18 +0000 |
commit | 7bf63b28f1dee0b582769879c1727c5a1171c2b1 (patch) | |
tree | 991a4907c63df8c43199fd749546234e0c150839 /meta/lib/oeqa/core/tests/test_data.py | |
parent | 4da4091cee20fd425addccd0d267a5b40f1ab8cd (diff) | |
download | poky-7bf63b28f1dee0b582769879c1727c5a1171c2b1.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
(From OE-Core rev: 7d7d0dc3736fc12ae7848de2785f0066e6470cd1)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/tests/test_data.py')
-rwxr-xr-x | meta/lib/oeqa/core/tests/test_data.py | 51 |
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 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | # Copyright (C) 2016 Intel Corporation | ||
4 | # Released under the MIT license (see COPYING.MIT) | ||
5 | |||
6 | import unittest | ||
7 | import logging | ||
8 | import os | ||
9 | |||
10 | from common import setup_sys_path, TestBase | ||
11 | setup_sys_path() | ||
12 | |||
13 | from oeqa.core.exception import OEQAMissingVariable | ||
14 | from oeqa.core.utils.test import getCaseMethod, getSuiteCasesNames | ||
15 | |||
16 | class TestData(TestBase): | ||
17 | modules = ['data'] | ||
18 | |||
19 | def test_data_fail_missing_variable(self): | ||
20 | expectedException = "oeqa.core.exception.OEQAMissingVariable" | ||
21 | |||
22 | tc = self._testLoader(modules=self.modules) | ||
23 | self.assertEqual(False, tc.runTests().wasSuccessful()) | ||
24 | for test, data in tc._results['errors']: | ||
25 | expect = False | ||
26 | if expectedException in data: | ||
27 | expect = True | ||
28 | |||
29 | self.assertTrue(expect) | ||
30 | |||
31 | def test_data_fail_wrong_variable(self): | ||
32 | expectedError = 'AssertionError' | ||
33 | d = {'IMAGE' : 'core-image-sato', 'ARCH' : 'arm'} | ||
34 | |||
35 | tc = self._testLoader(d=d, modules=self.modules) | ||
36 | self.assertEqual(False, tc.runTests().wasSuccessful()) | ||
37 | for test, data in tc._results['failures']: | ||
38 | expect = False | ||
39 | if expectedError in data: | ||
40 | expect = True | ||
41 | |||
42 | self.assertTrue(expect) | ||
43 | |||
44 | def test_data_ok(self): | ||
45 | d = {'IMAGE' : 'core-image-minimal', 'ARCH' : 'x86', 'MACHINE' : 'qemuarm'} | ||
46 | |||
47 | tc = self._testLoader(d=d, modules=self.modules) | ||
48 | self.assertEqual(True, tc.runTests().wasSuccessful()) | ||
49 | |||
50 | if __name__ == '__main__': | ||
51 | unittest.main() | ||