1*4882a593Smuzhiyun# 2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun 5*4882a593Smuzhiyunimport subprocess, unittest 6*4882a593Smuzhiyunfrom oeqa.sdk.case import OESDKTestCase 7*4882a593Smuzhiyun 8*4882a593Smuzhiyunfrom oeqa.utils.subprocesstweak import errors_have_output 9*4882a593Smuzhiyunerrors_have_output() 10*4882a593Smuzhiyun 11*4882a593Smuzhiyunclass Python3Test(OESDKTestCase): 12*4882a593Smuzhiyun def setUp(self): 13*4882a593Smuzhiyun if not (self.tc.hasHostPackage("nativesdk-python3-core") or 14*4882a593Smuzhiyun self.tc.hasHostPackage("python3-core-native")): 15*4882a593Smuzhiyun raise unittest.SkipTest("No python3 package in the SDK") 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun def test_python3(self): 18*4882a593Smuzhiyun cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" 19*4882a593Smuzhiyun output = self._run(cmd) 20*4882a593Smuzhiyun self.assertEqual(output, "Hello, world\n") 21