[tor-commits] [stem/master] assertRaisesRegexp didn't require exception with python 2.6

atagar at torproject.org atagar at torproject.org
Thu Apr 6 18:38:22 UTC 2017


commit c1b39820ebdf23ede9563d33e03043246dca27d7
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Mar 30 18:56:06 2017 -0700

    assertRaisesRegexp didn't require exception with python 2.6
    
    Oops, for python 2.6 we implement our own assertRaisesRegexp, but didn't fail
    the test if nothing was raised.
---
 stem/util/test_tools.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index b75c4d0..2600413 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -77,6 +77,7 @@ class TimedTestRunner(unittest.TextTestRunner):
           if stem.prereq._is_python_26():
             try:
               func(*args, **kwargs)
+              self.fail('Expected a %s to be raised but nothing was' % exc_type)
             except exc_type as exc:
               self.assertTrue(re.match(exc_msg, str(exc)))
           else:





More information about the tor-commits mailing list