1from oeqa.runtime.case import OERuntimeTestCase
2from oeqa.core.decorator.depends import OETestDepends
3from oeqa.core.decorator.oeid import OETestID
4
5class PythonTest(OERuntimeTestCase):
6    @classmethod
7    def setUpClass(cls):
8        import unittest
9        if "python3-core" not in cls.tc.image_packages:
10            raise unittest.SkipTest("Python3 not on target")
11
12    @OETestID(965)
13    @OETestDepends(['ssh.SSHTest.test_ssh'])
14    def test_python3(self):
15        cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
16        status, output = self.target.run(cmd)
17        msg = 'Exit status was not 0. Output: %s' % output
18        self.assertEqual(status, 0, msg=msg)
19
20        msg = 'Incorrect output: %s' % output
21        self.assertEqual(output, "Hello, world", msg=msg)
22