aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-11-29 17:39:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-29 23:34:46 +0000
commit4a62530f7616f40dd06191e1ca0f746c37ef86c5 (patch)
treefeb6f160673ad96c0c4b97c8b79112c26251aee1
parent5823d1c8431c83bdced32451246c4d982cbf25a3 (diff)
downloadopenembedded-core-contrib-4a62530f7616f40dd06191e1ca0f746c37ef86c5.tar.gz
oeqa/sdk/python: add Python 2 and fix detection
Add a Python 2 form to exercise that if present, and fix the setUp() so it actually looks for a package that exists (nativesdk-python3 is a virtual package, the interpretter is in nativesdk-python3-core). Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/sdk/cases/python.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 7c1d183e52..8b87141403 100644
--- a/meta/lib/oeqa/sdk/cases/python.py
+++ b/meta/lib/oeqa/sdk/cases/python.py
@@ -1,14 +1,28 @@
import subprocess, unittest
from oeqa.sdk.case import OESDKTestCase
-class PythonTest(OESDKTestCase):
+class Python2Test(OESDKTestCase):
def setUp(self):
- if not (self.tc.hasHostPackage("nativesdk-python3") or
- self.tc.hasHostPackage("python3-native")):
+ if not (self.tc.hasHostPackage("nativesdk-python-core") or
+ self.tc.hasHostPackage("python-core-native")):
raise unittest.SkipTest("No python package in the SDK")
def test_python3(self):
try:
+ cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
+ output = self._run(cmd)
+ self.assertEqual(output, "Hello, world\n")
+ except subprocess.CalledProcessError as e:
+ self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))
+
+class Python3Test(OESDKTestCase):
+ def setUp(self):
+ if not (self.tc.hasHostPackage("nativesdk-python3-core") or
+ self.tc.hasHostPackage("python3-core-native")):
+ raise unittest.SkipTest("No python3 package in the SDK")
+
+ def test_python3(self):
+ try:
cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
output = self._run(cmd)
self.assertEqual(output, "Hello, world\n")