summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/python.py
blob: 7c1d183e5291a60757dca5b3678898883be053c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import subprocess, unittest
from oeqa.sdk.case import OESDKTestCase

class PythonTest(OESDKTestCase):
    def setUp(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))