diff options
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() | ||