summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-07-16 13:54:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 10:18:42 +0100
commitebad780985ce9bc8b11293ac90fc4d98b6ae0b2c (patch)
tree78ada461562c170856de66fc8f1ea5664e2c6561 /meta/lib/oeqa/sdk
parent731ce8c760a7f1376ba1b634db2e769206e5dae1 (diff)
downloadpoky-ebad780985ce9bc8b11293ac90fc4d98b6ae0b2c.tar.gz
oeqa/sdk/python: clean up Python test
For the same reasons as the runtime Python test, clean up the SDK test. Also port from Python 2 to Python 3, as that's what is supported now. (From OE-Core rev: bead742a3ffc0a53162fb0c36610d74a1422e7b3) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk')
-rw-r--r--meta/lib/oeqa/sdk/cases/python.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 72dfcc72bd..bd5f1f67be 100644
--- a/meta/lib/oeqa/sdk/cases/python.py
+++ b/meta/lib/oeqa/sdk/cases/python.py
@@ -1,32 +1,17 @@
1import os 1import subprocess, unittest
2import shutil
3import unittest
4
5from oeqa.core.utils.path import remove_safe
6from oeqa.sdk.case import OESDKTestCase 2from oeqa.sdk.case import OESDKTestCase
7 3
8class PythonTest(OESDKTestCase): 4class PythonTest(OESDKTestCase):
9 @classmethod 5 @classmethod
10 def setUpClass(self): 6 def setUpClass(self):
11 if not (self.tc.hasHostPackage("nativesdk-python") or 7 if not (self.tc.hasHostPackage("nativesdk-python3") or
12 self.tc.hasHostPackage("python-native")): 8 self.tc.hasHostPackage("python3-native")):
13 raise unittest.SkipTest("No python package in the SDK") 9 raise unittest.SkipTest("No python package in the SDK")
14 10
15 for f in ['test.py']: 11 def test_python3(self):
16 shutil.copyfile(os.path.join(self.tc.files_dir, f), 12 try:
17 os.path.join(self.tc.sdk_dir, f)) 13 cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
18 14 output = self._run(cmd)
19 def test_python_exists(self): 15 self.assertEqual(output, "Hello, world\n")
20 self._run('which python') 16 except subprocess.CalledProcessError as e:
21 17 self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))
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")