[oe-commits] [openembedded-core] 39/46: oeqa/sdk/python: add Python 2 and fix detection

git at git.openembedded.org git at git.openembedded.org
Fri Nov 30 17:35:44 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit af0d02502725babd56181ec371326d2133448f5c
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Thu Nov 29 17:39:33 2018 +0000

    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 at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/sdk/cases/python.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 7c1d183..8b87141 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")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list