xref: /openbmc/openbmc/poky/meta/lib/oeqa/runtime/cases/python.py (revision 92b42cb35d755f8cfe6c17d403711a536e0f0721)
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7from oeqa.runtime.case import OERuntimeTestCase
8from oeqa.core.decorator.depends import OETestDepends
9from oeqa.runtime.decorator.package import OEHasPackage
10
11class PythonTest(OERuntimeTestCase):
12    @OETestDepends(['ssh.SSHTest.test_ssh'])
13    @OEHasPackage(['python3-core'])
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