summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/python.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-11-27 17:51:53 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:19 +0000
commitc9fe59d7c5e815fb6453f50d0f15699ea6799129 (patch)
tree4e7715c04b705eb78f49e55d421b25483c594f9c /meta/lib/oeqa/sdk/cases/python.py
parent51be1880631435627e8ff490d71b024c2683244a (diff)
downloadpoky-c9fe59d7c5e815fb6453f50d0f15699ea6799129.tar.gz
oeqa/sdk/cases: Migrate tests to the new OEQA framework
Summary of the changes: - Remove auto extend_path using pkgutil at __init__, is not needed. - Change base class to OESDKTestCase. - Add td_vars attr to set dependencies of certain variables in test data. - Change skips from module level to class level because Test context (tc) now isn't at module level. - Variable names changes to be consistent (i.e. sdktestdir -> sdk_dir). [YOCTO #10599] - Don't use bb.utils functions use instead remove_safe and shutil for copy files. - SDKBuildProject pass test data variables instead of call getVar inside. [YOCTO #10231] (From OE-Core rev: 91cd1ed19a3f34c29cd77eb136036975fe465444) 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/sdk/cases/python.py')
-rw-r--r--meta/lib/oeqa/sdk/cases/python.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 896fab4dfb..94a296f0ec 100644
--- a/meta/lib/oeqa/sdk/cases/python.py
+++ b/meta/lib/oeqa/sdk/cases/python.py
@@ -1,26 +1,25 @@
1import unittest
2import os 1import os
3import shutil 2import shutil
4from oeqa.oetest import oeSDKTest, skipModule 3import unittest
5from oeqa.utils.decorators import *
6
7def setUpModule():
8 if not oeSDKTest.hasHostPackage("nativesdk-python"):
9 skipModule("No python package in the SDK")
10
11 4
12class PythonTest(oeSDKTest): 5from oeqa.core.utils.path import remove_safe
6from oeqa.sdk.case import OESDKTestCase
13 7
8class PythonTest(OESDKTestCase):
14 @classmethod 9 @classmethod
15 def setUpClass(self): 10 def setUpClass(self):
11 if not self.tc.hasHostPackage("nativesdk-python"):
12 raise unittest.SkipTest("No python package in the SDK")
13
16 for f in ['test.py']: 14 for f in ['test.py']:
17 shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) 15 shutil.copyfile(os.path.join(self.tc.files_dir, f),
16 os.path.join(self.tc.sdk_dir, f))
18 17
19 def test_python_exists(self): 18 def test_python_exists(self):
20 self._run('which python') 19 self._run('which python')
21 20
22 def test_python_stdout(self): 21 def test_python_stdout(self):
23 output = self._run('python %s/test.py' % self.tc.sdktestdir) 22 output = self._run('python %s/test.py' % self.tc.sdk_dir)
24 self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output) 23 self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output)
25 24
26 def test_python_testfile(self): 25 def test_python_testfile(self):
@@ -28,5 +27,5 @@ class PythonTest(oeSDKTest):
28 27
29 @classmethod 28 @classmethod
30 def tearDownClass(self): 29 def tearDownClass(self):
31 bb.utils.remove("%s/test.py" % self.tc.sdktestdir) 30 remove_safe("%s/test.py" % self.tc.sdk_dir)
32 bb.utils.remove("/tmp/testfile.python") 31 remove_safe("/tmp/testfile.python")