Mercurial > babel > mirror
diff babel/messages/tests/frontend.py @ 605:6dc7e067bafc trunk
fix 'input_dirs' option for setuptools integration (#232, initial patch by ?tienne Bersac)
author | fschwarz |
---|---|
date | Thu, 23 Aug 2012 09:48:21 +0000 |
parents | e61e27d9347d |
children |
line wrap: on
line diff
--- a/babel/messages/tests/frontend.py +++ b/babel/messages/tests/frontend.py @@ -28,6 +28,7 @@ from babel.dates import format_datetime from babel.messages import frontend from babel.util import LOCALTZ +from babel.messages.pofile import read_po this_dir = os.path.abspath(os.path.dirname(__file__)) @@ -108,6 +109,24 @@ self.cmd.sort_by_file = True self.assertRaises(DistutilsOptionError, self.cmd.finalize_options) + def test_input_dirs_is_treated_as_list(self): + self.cmd.input_dirs = self.datadir + self.cmd.output_file = self._pot_file() + self.cmd.finalize_options() + self.cmd.run() + + catalog = read_po(open(self._pot_file(), 'U')) + msg = catalog.get('bar') + self.assertEqual(1, len(msg.locations)) + self.assertTrue('file1.py' in msg.locations[0][0]) + + def test_input_dirs_handle_spaces_after_comma(self): + self.cmd.input_dirs = 'foo, bar' + self.cmd.output_file = self._pot_file() + self.cmd.finalize_options() + + self.assertEqual(['foo', 'bar'], self.cmd.input_dirs) + def test_extraction_with_default_mapping(self): self.cmd.copyright_holder = 'FooBar, Inc.' self.cmd.msgid_bugs_address = 'bugs.address@email.tld'