diff options
author | Ross Burton <ross.burton@intel.com> | 2018-11-29 17:39:33 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-03 12:20:01 +0000 |
commit | fefe59b2e647a7778c1fa5f575f4646ec2eb2808 (patch) | |
tree | 472e5ad6ce03dc3a743aa0d874c8bce3dd8b8a84 /meta/lib | |
parent | 9775741a20937cab6ccd0c359482bc08d1a2b2d6 (diff) | |
download | poky-fefe59b2e647a7778c1fa5f575f4646ec2eb2808.tar.gz |
oeqa/sdk/python: add Python 2 and fix detection
Add a Python 2 form to exercise that if present, and fix the setUp() so it
actually looks for a package that exists (nativesdk-python3 is a virtual
package, the interpretter is in nativesdk-python3-core).
(From OE-Core rev: d286c2ad3eec24978557e16a8fa599476791109f)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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") |