Mercurial > babel > old > babel-test
comparison 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 |
comparison
equal
deleted
inserted
replaced
507:b29ff192b610 | 508:dbb70d75718a |
---|---|
523 def test_usage(self): | 523 def test_usage(self): |
524 try: | 524 try: |
525 self.cli.run(sys.argv) | 525 self.cli.run(sys.argv) |
526 self.fail('Expected SystemExit') | 526 self.fail('Expected SystemExit') |
527 except SystemExit, e: | 527 except SystemExit, e: |
528 self.assertEqual(2, e.code) | 528 stderr = sys.stderr.getvalue() |
529 if isinstance(e.code, int): | |
530 self.assertEqual(2, e.code) | |
531 else: | |
532 # OptionParser in Python 2.3 does not set the exit code. | |
533 # Instead the 'code' contains the custom error message from the | |
534 # frontend | |
535 stderr = stderr + e.code + '\n' | |
529 self.assertEqual("""\ | 536 self.assertEqual("""\ |
530 usage: pybabel command [options] [args] | 537 usage: pybabel command [options] [args] |
531 | 538 |
532 pybabel: error: no valid command or option passed. try the -h/--help option for more information. | 539 pybabel: error: no valid command or option passed. try the -h/--help option for more information. |
533 """, sys.stderr.getvalue().lower()) | 540 """, stderr.lower()) |
534 | 541 |
535 def test_help(self): | 542 def test_help(self): |
536 try: | 543 try: |
537 self.cli.run(sys.argv + ['--help']) | 544 self.cli.run(sys.argv + ['--help']) |
538 self.fail('Expected SystemExit') | 545 self.fail('Expected SystemExit') |