summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/python.py
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-12-11 23:26:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-13 16:32:21 +0000
commit5e15b242a49ded354d23cff616365209d3f8588b (patch)
treec4da839539b2b99280a4b82e2ec300ba2f87dc80 /meta/lib/oeqa/sdk/cases/python.py
parent778f3ce1e66ebc517a36d8567b5debbf317be343 (diff)
downloadpoky-5e15b242a49ded354d23cff616365209d3f8588b.tar.gz
oeqa/sdk: show output if run() fails
Use oeqa.utils.subprocesstweak to monkey-patch the subprocess exception so that any output is shown, and remove any explicit try/catch handling that would have hidden this. (From OE-Core rev: 55964b33b561397287779ee474170790dfd03e85) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/python.py')
-rw-r--r--meta/lib/oeqa/sdk/cases/python.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 2254867d45..b9174fadba 100644
--- a/meta/lib/oeqa/sdk/cases/python.py
+++ b/meta/lib/oeqa/sdk/cases/python.py
@@ -1,6 +1,9 @@
1import subprocess, unittest 1import subprocess, unittest
2from oeqa.sdk.case import OESDKTestCase 2from oeqa.sdk.case import OESDKTestCase
3 3
4from oeqa.utils.subprocesstweak import errors_have_output
5errors_have_output()
6
4class Python2Test(OESDKTestCase): 7class Python2Test(OESDKTestCase):
5 def setUp(self): 8 def setUp(self):
6 if not (self.tc.hasHostPackage("nativesdk-python-core") or 9 if not (self.tc.hasHostPackage("nativesdk-python-core") or
@@ -8,12 +11,9 @@ class Python2Test(OESDKTestCase):
8 raise unittest.SkipTest("No python package in the SDK") 11 raise unittest.SkipTest("No python package in the SDK")
9 12
10 def test_python2(self): 13 def test_python2(self):
11 try: 14 cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
12 cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" 15 output = self._run(cmd)
13 output = self._run(cmd) 16 self.assertEqual(output, "Hello, world\n")
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 17
18class Python3Test(OESDKTestCase): 18class Python3Test(OESDKTestCase):
19 def setUp(self): 19 def setUp(self):
@@ -22,9 +22,6 @@ class Python3Test(OESDKTestCase):
22 raise unittest.SkipTest("No python3 package in the SDK") 22 raise unittest.SkipTest("No python3 package in the SDK")
23 23
24 def test_python3(self): 24 def test_python3(self):
25 try: 25 cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
26 cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" 26 output = self._run(cmd)
27 output = self._run(cmd) 27 self.assertEqual(output, "Hello, world\n")
28 self.assertEqual(output, "Hello, world\n")
29 except subprocess.CalledProcessError as e:
30 self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))