diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/files/test.py | 6 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/python.py | 35 |
2 files changed, 10 insertions, 31 deletions
diff --git a/meta/lib/oeqa/files/test.py b/meta/lib/oeqa/files/test.py deleted file mode 100644 index f389225d72..0000000000 --- a/meta/lib/oeqa/files/test.py +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | import os | ||
2 | |||
3 | os.system('touch /tmp/testfile.python') | ||
4 | |||
5 | a = 9.01e+21 - 9.01e+21 + 0.01 | ||
6 | print("the value of a is %s" % a) | ||
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index 72dfcc72bd..bd5f1f67be 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py | |||
@@ -1,32 +1,17 @@ | |||
1 | import os | 1 | import subprocess, unittest |
2 | import shutil | ||
3 | import unittest | ||
4 | |||
5 | from oeqa.core.utils.path import remove_safe | ||
6 | from oeqa.sdk.case import OESDKTestCase | 2 | from oeqa.sdk.case import OESDKTestCase |
7 | 3 | ||
8 | class PythonTest(OESDKTestCase): | 4 | class PythonTest(OESDKTestCase): |
9 | @classmethod | 5 | @classmethod |
10 | def setUpClass(self): | 6 | def setUpClass(self): |
11 | if not (self.tc.hasHostPackage("nativesdk-python") or | 7 | if not (self.tc.hasHostPackage("nativesdk-python3") or |
12 | self.tc.hasHostPackage("python-native")): | 8 | self.tc.hasHostPackage("python3-native")): |
13 | raise unittest.SkipTest("No python package in the SDK") | 9 | raise unittest.SkipTest("No python package in the SDK") |
14 | 10 | ||
15 | for f in ['test.py']: | 11 | def test_python3(self): |
16 | shutil.copyfile(os.path.join(self.tc.files_dir, f), | 12 | try: |
17 | os.path.join(self.tc.sdk_dir, f)) | 13 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
18 | 14 | output = self._run(cmd) | |
19 | def test_python_exists(self): | 15 | self.assertEqual(output, "Hello, world\n") |
20 | self._run('which python') | 16 | except subprocess.CalledProcessError as e: |
21 | 17 | self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) | |
22 | def test_python_stdout(self): | ||
23 | output = self._run('python %s/test.py' % self.tc.sdk_dir) | ||
24 | self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output) | ||
25 | |||
26 | def test_python_testfile(self): | ||
27 | self._run('ls /tmp/testfile.python') | ||
28 | |||
29 | @classmethod | ||
30 | def tearDownClass(self): | ||
31 | remove_safe("%s/test.py" % self.tc.sdk_dir) | ||
32 | remove_safe("/tmp/testfile.python") | ||