summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2010-04-16 13:15:32 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2010-04-16 13:18:08 -0400
commitbc761965628b9dba93094bb7acfd3b26612fdef1 (patch)
treeed3c7ea5a3c06205260050438c3b1d5c18382fbe
parent15c3b04f4257fef54ca5f7ab60012b4936d672a3 (diff)
downloadpygobject-bc761965628b9dba93094bb7acfd3b26612fdef1.tar.gz
pygobject-bc761965628b9dba93094bb7acfd3b26612fdef1.tar.xz
pygobject-bc761965628b9dba93094bb7acfd3b26612fdef1.zip
Make the option callback failure selftest work with both Python 2 and 3HEADpy3k
StandardError went away in Python 3; use Exception instead, as it ought to work with both Python 2 and Python 3
-rw-r--r--tests/test_option.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_option.py b/tests/test_option.py
index ad5f1b3..beb55bf 100644
--- a/tests/test_option.py
+++ b/tests/test_option.py
@@ -26,7 +26,7 @@ class TestOption(unittest.TestCase):
def _create_group(self):
def option_callback(option, opt, value, parser):
- raise StandardError(self.EXCEPTION_MESSAGE)
+ raise Exception(self.EXCEPTION_MESSAGE)
group = OptionGroup(
"unittest", "Unit test options", "Show all unittest options",
@@ -101,7 +101,7 @@ class TestOption(unittest.TestCase):
def testOptionGroupConstructor(self):
self.assertRaises(TypeError, OptionGroup)
- def testStandardError(self):
+ def testCallbackFailure(self):
self._create_group()
sio = StringIO()
old_stderr = sys.stderr
@@ -111,6 +111,7 @@ class TestOption(unittest.TestCase):
["test_option.py", "--callback-failure-test"])
finally:
sys.stderr = old_stderr
- assert (sio.getvalue().split('\n')[-2] ==
- "StandardError: " + self.EXCEPTION_MESSAGE)
+
+ self.assertEquals(sio.getvalue().split('\n')[-2],
+ 'Exception: ' + self.EXCEPTION_MESSAGE)