summaryrefslogtreecommitdiffstats
path: root/testsuite/common.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-05 11:49:27 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-05 11:49:27 -0400
commit3f7a5c489ada79121065e3835008d5ba60038b3d (patch)
tree98e5ccf1bbf47ac6e718357b4f3dea28286d19f6 /testsuite/common.py
parent86848d0b7790f62a949637e4fbc13afccd3013e7 (diff)
downloadbcfg2-3f7a5c489ada79121065e3835008d5ba60038b3d.tar.gz
bcfg2-3f7a5c489ada79121065e3835008d5ba60038b3d.tar.bz2
bcfg2-3f7a5c489ada79121065e3835008d5ba60038b3d.zip
fixed some of our unittest convenience methods
Diffstat (limited to 'testsuite/common.py')
-rw-r--r--testsuite/common.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/testsuite/common.py b/testsuite/common.py
index 403d3dda7..9af5e2bc7 100644
--- a/testsuite/common.py
+++ b/testsuite/common.py
@@ -1,4 +1,5 @@
import os
+import re
import sys
import unittest
from mock import patch, MagicMock, _patch, DEFAULT
@@ -126,7 +127,7 @@ if not hasattr(unittest.TestCase, "assertItemsEqual"):
return result
-if True or not hasattr(unittest.TestCase, "assertIn"):
+if not hasattr(unittest.TestCase, "assertIn"):
# versions of TestCase before python 2.7 and python 3.1 lacked a
# lot of the really handy convenience methods, so we provide them
# -- at least the easy ones and the ones we use.
@@ -139,7 +140,12 @@ if True or not hasattr(unittest.TestCase, "assertIn"):
msg = kwargs['msg']
del kwargs['msg']
else:
- msg = default_msg % args
+ try:
+ msg = default_msg % args
+ except TypeError:
+ # message passed as final (non-keyword) argument?
+ msg = args[-1]
+ args = args[:-1]
assert predicate(*args, **kwargs), msg
return inner