blob: b9174fadbaaec22365a23ad2c413626c63800de2 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001import subprocess, unittest
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002from oeqa.sdk.case import OESDKTestCase
3
Brad Bishop19323692019-04-05 15:28:33 -04004from oeqa.utils.subprocesstweak import errors_have_output
5errors_have_output()
6
7class Python2Test(OESDKTestCase):
8 def setUp(self):
9 if not (self.tc.hasHostPackage("nativesdk-python-core") or
10 self.tc.hasHostPackage("python-core-native")):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011 raise unittest.SkipTest("No python package in the SDK")
12
Brad Bishop19323692019-04-05 15:28:33 -040013 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
18class 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 Bishop1a4b7ee2018-12-16 17:11:34 -080024 def test_python3(self):
Brad Bishop19323692019-04-05 15:28:33 -040025 cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
26 output = self._run(cmd)
27 self.assertEqual(output, "Hello, world\n")