summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/python.py
diff options
context:
space:
mode:
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")