blob: 94a296f0ec922e127d1b4d32292c031a2f59b4d9 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001import os
2import shutil
3import unittest
4
5from oeqa.core.utils.path import remove_safe
6from oeqa.sdk.case import OESDKTestCase
7
8class PythonTest(OESDKTestCase):
9 @classmethod
10 def setUpClass(self):
11 if not self.tc.hasHostPackage("nativesdk-python"):
12 raise unittest.SkipTest("No python package in the SDK")
13
14 for f in ['test.py']:
15 shutil.copyfile(os.path.join(self.tc.files_dir, f),
16 os.path.join(self.tc.sdk_dir, f))
17
18 def test_python_exists(self):
19 self._run('which python')
20
21 def test_python_stdout(self):
22 output = self._run('python %s/test.py' % self.tc.sdk_dir)
23 self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output)
24
25 def test_python_testfile(self):
26 self._run('ls /tmp/testfile.python')
27
28 @classmethod
29 def tearDownClass(self):
30 remove_safe("%s/test.py" % self.tc.sdk_dir)
31 remove_safe("/tmp/testfile.python")