summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/tests/test_data.py
diff options
context:
space:
mode:
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 @@
1#!/usr/bin/env python3
2
3# Copyright (C) 2016 Intel Corporation
4# Released under the MIT license (see COPYING.MIT)
5
6import unittest
7import logging
8import os
9
10from common import setup_sys_path, TestBase
11setup_sys_path()
12
13from oeqa.core.exception import OEQAMissingVariable
14from oeqa.core.utils.test import getCaseMethod, getSuiteCasesNames
15
16class 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
50if __name__ == '__main__':
51 unittest.main()