blob: bd5f1f67be265cfdd81411cc693b68a137197582 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001import subprocess, unittest
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002from oeqa.sdk.case import OESDKTestCase
3
4class PythonTest(OESDKTestCase):
5 @classmethod
6 def setUpClass(self):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007 if not (self.tc.hasHostPackage("nativesdk-python3") or
8 self.tc.hasHostPackage("python3-native")):
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009 raise unittest.SkipTest("No python package in the SDK")
10
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011 def test_python3(self):
12 try:
13 cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
14 output = self._run(cmd)
15 self.assertEqual(output, "Hello, world\n")
16 except subprocess.CalledProcessError as e:
17 self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))