Skip to contentSkip to conversation

lib/oeqa/runtime/cases: add python2.py

PATCH New Tim Orling 1 participant 1 message Jan 22, 2020

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/1 lib/oeqa/runtime/cases: add python2.py

Refactor the python3 test from oe-core to do very
basic acceptance test of python2.

---
 lib/oeqa/runtime/cases/python2.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 lib/oeqa/runtime/cases/python2.py
lib/oeqa/runtime/cases/python2.py new file +20 -0
new file mode 100644
index 00000000..8afa2ac9
@@ -0,0 +1,20 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+
+
+class PythonTest(OERuntimeTestCase):
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    @OEHasPackage(['python-core'])
+    def test_python(self):
+        cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
+        status, output = self.target.run(cmd)
+        msg = 'Exit status was not 0. Output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
+        msg = 'Incorrect output: %s' % output
+        self.assertEqual(output, "Hello, world", msg=msg)
Signature · 1 line
2.25.0