Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | import subprocess, unittest |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | from oeqa.sdk.case import OESDKTestCase |
| 3 | |
| 4 | class PythonTest(OESDKTestCase): |
| 5 | @classmethod |
| 6 | def setUpClass(self): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 7 | if not (self.tc.hasHostPackage("nativesdk-python3") or |
| 8 | self.tc.hasHostPackage("python3-native")): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | raise unittest.SkipTest("No python package in the SDK") |
| 10 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 11 | def test_python3(self): |
| 12 | try: |
| 13 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
| 14 | output = self._run(cmd) |
| 15 | self.assertEqual(output, "Hello, world\n") |
| 16 | except subprocess.CalledProcessError as e: |
| 17 | self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) |