Mercurial > babel > old > babel-test
diff babel/messages/tests/frontend.py @ 508:dbb70d75718a stable-0.9.x
Fix Python 2.3 compatibility for 0.9 branch (closes #233)
author | fschwarz |
---|---|
date | Fri, 04 Mar 2011 14:16:15 +0000 |
parents | ee0b9aa340df |
children | 4a5340c0821b |
line wrap: on
line diff
--- a/babel/messages/tests/frontend.py +++ b/babel/messages/tests/frontend.py @@ -525,12 +525,19 @@ self.cli.run(sys.argv) self.fail('Expected SystemExit') except SystemExit, e: - self.assertEqual(2, e.code) + stderr = sys.stderr.getvalue() + if isinstance(e.code, int): + self.assertEqual(2, e.code) + else: + # OptionParser in Python 2.3 does not set the exit code. + # Instead the 'code' contains the custom error message from the + # frontend + stderr = stderr + e.code + '\n' self.assertEqual("""\ usage: pybabel command [options] [args] pybabel: error: no valid command or option passed. try the -h/--help option for more information. -""", sys.stderr.getvalue().lower()) +""", stderr.lower()) def test_help(self): try: