diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-09-03 21:57:00 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-09-03 21:57:00 +0200 |
commit | 1e1f5b2f2f15547c1f2cbc948d2b764bd0a37c44 (patch) | |
tree | 296deadd6dd2332fde5c5d964351d0084376ce3c /tests/test_everything.py | |
parent | 41bb687c058e08b05108b4b2f081cd83d4f93da8 (diff) | |
download | pygobject-1e1f5b2f2f15547c1f2cbc948d2b764bd0a37c44.tar.gz |
Fix exception test case for Python 2
Regression from commit 77844c5 which did not work with Python 2.
Diffstat (limited to 'tests/test_everything.py')
-rw-r--r-- | tests/test_everything.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_everything.py b/tests/test_everything.py index 406fcb32..c5140ed0 100644 --- a/tests/test_everything.py +++ b/tests/test_everything.py @@ -234,11 +234,13 @@ class TestEverything(unittest.TestCase): try: Everything.TestBoxedPrivate() self.fail('allocating disguised struct without default constructor unexpectedly succeeded') - except TypeError as e: - self.assertTrue('TestBoxedPrivate' in str(e), str(e)) - self.assertTrue('override' in str(e), str(e)) - self.assertTrue('constructor' in str(e), str(e)) - tb = ''.join(traceback.format_exception(type(e), e, e.__traceback__)) + except TypeError: + (e_type, e_value, e_tb) = sys.exc_info() + self.assertEqual(e_type, TypeError) + self.assertTrue('TestBoxedPrivate' in str(e_value), str(e_value)) + self.assertTrue('override' in str(e_value), str(e_value)) + self.assertTrue('constructor' in str(e_value), str(e_value)) + tb = ''.join(traceback.format_exception(e_type, e_value, e_tb)) self.assertTrue('tests/test_everything.py", line' in tb, tb) |