xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/sdk/cases/python.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#
2# SPDX-License-Identifier: MIT
3#
4
5import subprocess, unittest
6from oeqa.sdk.case import OESDKTestCase
7
8from oeqa.utils.subprocesstweak import errors_have_output
9errors_have_output()
10
11class Python3Test(OESDKTestCase):
12    def setUp(self):
13        if not (self.tc.hasHostPackage("nativesdk-python3-core") or
14                self.tc.hasHostPackage("python3-core-native")):
15            raise unittest.SkipTest("No python3 package in the SDK")
16
17    def test_python3(self):
18        cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
19        output = self._run(cmd)
20        self.assertEqual(output, "Hello, world\n")
21