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 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 4 | from oeqa.utils.subprocesstweak import errors_have_output |
| 5 | errors_have_output() |
| 6 | |
| 7 | class Python2Test(OESDKTestCase): |
| 8 | def setUp(self): |
| 9 | if not (self.tc.hasHostPackage("nativesdk-python-core") or |
| 10 | self.tc.hasHostPackage("python-core-native")): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | raise unittest.SkipTest("No python package in the SDK") |
| 12 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 13 | def test_python2(self): |
| 14 | cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
| 15 | output = self._run(cmd) |
| 16 | self.assertEqual(output, "Hello, world\n") |
| 17 | |
| 18 | class Python3Test(OESDKTestCase): |
| 19 | def setUp(self): |
| 20 | if not (self.tc.hasHostPackage("nativesdk-python3-core") or |
| 21 | self.tc.hasHostPackage("python3-core-native")): |
| 22 | raise unittest.SkipTest("No python3 package in the SDK") |
| 23 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | def test_python3(self): |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 25 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
| 26 | output = self._run(cmd) |
| 27 | self.assertEqual(output, "Hello, world\n") |