diff options
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/python.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index 7c1d183e52..8b87141403 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py | |||
| @@ -1,14 +1,28 @@ | |||
| 1 | import subprocess, unittest | 1 | import subprocess, unittest |
| 2 | from oeqa.sdk.case import OESDKTestCase | 2 | from oeqa.sdk.case import OESDKTestCase |
| 3 | 3 | ||
| 4 | class PythonTest(OESDKTestCase): | 4 | class Python2Test(OESDKTestCase): |
| 5 | def setUp(self): | 5 | def setUp(self): |
| 6 | if not (self.tc.hasHostPackage("nativesdk-python3") or | 6 | if not (self.tc.hasHostPackage("nativesdk-python-core") or |
| 7 | self.tc.hasHostPackage("python3-native")): | 7 | self.tc.hasHostPackage("python-core-native")): |
| 8 | raise unittest.SkipTest("No python package in the SDK") | 8 | raise unittest.SkipTest("No python package in the SDK") |
| 9 | 9 | ||
| 10 | def test_python3(self): | 10 | def test_python3(self): |
| 11 | try: | 11 | try: |
| 12 | cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" | ||
| 13 | output = self._run(cmd) | ||
| 14 | self.assertEqual(output, "Hello, world\n") | ||
| 15 | except subprocess.CalledProcessError as e: | ||
| 16 | self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) | ||
| 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 | |||
| 24 | def test_python3(self): | ||
| 25 | try: | ||
| 12 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" | 26 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
| 13 | output = self._run(cmd) | 27 | output = self._run(cmd) |
| 14 | self.assertEqual(output, "Hello, world\n") | 28 | self.assertEqual(output, "Hello, world\n") |
