mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

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). (From OE-Core rev: d286c2ad3eec24978557e16a8fa599476791109f) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
import subprocess, unittest
|
|
from oeqa.sdk.case import OESDKTestCase
|
|
|
|
class Python2Test(OESDKTestCase):
|
|
def setUp(self):
|
|
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")
|
|
except subprocess.CalledProcessError as e:
|
|
self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))
|