[tor-commits] [stem/master] Expand installation test failure message

atagar at torproject.org atagar at torproject.org
Sat Apr 4 01:15:40 UTC 2020


commit 4c2dbd85e1461409b6654e8cd5d87400083d7fec
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Apr 3 18:13:50 2020 -0700

    Expand installation test failure message
    
    We recently adjusted our setup.py and though it passes locally, Jenkins is
    sad...
    
      ======================================================================
      FAIL: test_install
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/util/test_tools.py", line 141, in <lambda>
          self.method = lambda test: self.result(test)  # method that can be mixed into TestCases
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/util/test_tools.py", line 208, in result
          test.fail(self._result.msg)
      AssertionError: Unable to install with 'python setup.py install': /usr/bin/python3 setup.py install --prefix /tmp/stem_test returned exit status 1
    
    Adding our stdout and stderr to the exception output so we get more to go on.
---
 test/integ/installation.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/test/integ/installation.py b/test/integ/installation.py
index 39b604bb..98856622 100644
--- a/test/integ/installation.py
+++ b/test/integ/installation.py
@@ -79,8 +79,26 @@ class TestInstallation(unittest.TestCase):
           site_packages_paths = glob.glob('%s/site-packages' % BASE_INSTALL_PATH)
         else:
           site_packages_paths = glob.glob('%s/lib*/*/site-packages/*' % BASE_INSTALL_PATH)
-      except Exception as exc:
-        raise AssertionError("Unable to install with 'python setup.py install': %s" % exc)
+      except stem.util.system.CallError as exc:
+        msg = ["Unable to install with 'python setup.py install': %s" % exc]
+
+        if exc.stdout:
+          msg += [
+            '-' * 40,
+            'stdout:',
+            '-' * 40,
+            exc.stdout.decode('utf-8'),
+          ]
+
+        if exc.stderr:
+          msg += [
+            '-' * 40,
+            'stderr:',
+            '-' * 40,
+            exc.stderr.decode('utf-8'),
+          ]
+
+        raise AssertionError('\n'.join(msg))
 
       if len(site_packages_paths) != 1:
         raise AssertionError('We should only have a single site-packages directory, but instead had: %s' % site_packages_paths)



More information about the tor-commits mailing list