blob: 72dfcc72bde5fd1a320847e845eef34a21fa8d8c [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):
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011 if not (self.tc.hasHostPackage("nativesdk-python") or
12 self.tc.hasHostPackage("python-native")):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 raise unittest.SkipTest("No python package in the SDK")
14
15 for f in ['test.py']:
16 shutil.copyfile(os.path.join(self.tc.files_dir, f),
17 os.path.join(self.tc.sdk_dir, f))
18
19 def test_python_exists(self):
20 self._run('which python')
21
22 def test_python_stdout(self):
23 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)
25
26 def test_python_testfile(self):
27 self._run('ls /tmp/testfile.python')
28
29 @classmethod
30 def tearDownClass(self):
31 remove_safe("%s/test.py" % self.tc.sdk_dir)
32 remove_safe("/tmp/testfile.python")