Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | from oeqa.runtime.case import OERuntimeTestCase |
| 2 | from oeqa.core.decorator.depends import OETestDepends |
| 3 | from oeqa.core.decorator.oeid import OETestID |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 4 | |
| 5 | class PythonTest(OERuntimeTestCase): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | @classmethod |
| 7 | def setUpClass(cls): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 8 | import unittest |
| 9 | if "python3-core" not in cls.tc.image_packages: |
| 10 | raise unittest.SkipTest("Python3 not on target") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | |
| 12 | @OETestID(965) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 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) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | msg = 'Exit status was not 0. Output: %s' % output |
| 18 | self.assertEqual(status, 0, msg=msg) |
| 19 | |
| 20 | msg = 'Incorrect output: %s' % output |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 21 | self.assertEqual(output, "Hello, world", msg=msg) |