Files
poky/meta/lib/oeqa/sdk/cases/python.py
Ross Burton ebad780985 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>
2018-07-18 10:18:42 +01:00

18 lines
698 B
Python

import subprocess, unittest
from oeqa.sdk.case import OESDKTestCase
class PythonTest(OESDKTestCase):
@classmethod
def setUpClass(self):
if not (self.tc.hasHostPackage("nativesdk-python3") or
self.tc.hasHostPackage("python3-native")):
raise unittest.SkipTest("No python 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))