diff options
author | Aarni Koskela <akx@iki.fi> | 2016-04-11 13:44:39 +0300 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2016-04-12 09:20:26 +0300 |
commit | fbc1648756e025558e1e9a7987e92f13af097f80 (patch) | |
tree | d1c917eec04b50a0db104b0f2938230e65f62292 /tests/messages | |
parent | 3e67c9998dfb4b901a20182a3a5b1301b34831a1 (diff) | |
download | babel-fbc1648756e025558e1e9a7987e92f13af097f80.tar.gz |
Refactor out `configure_cli_command`
Diffstat (limited to 'tests/messages')
-rw-r--r-- | tests/messages/test_frontend.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py index 4c3c4a5..e0c9a8e 100644 --- a/tests/messages/test_frontend.py +++ b/tests/messages/test_frontend.py @@ -1232,6 +1232,19 @@ def test_parse_keywords(): } +def configure_cli_command(cmdline): + """ + Helper to configure a command class, but not run it just yet. + + :param cmdline: The command line (sans the executable name) + :return: Command instance + """ + args = shlex.split(cmdline) + cli = CommandLineInterface() + cmdinst = cli._configure_command(cmdname=args[0], argv=args[1:]) + return cmdinst + + @pytest.mark.parametrize("split", (False, True)) def test_extract_keyword_args_384(split): # This is a regression test for https://github.com/python-babel/babel/issues/384 @@ -1254,11 +1267,9 @@ def test_extract_keyword_args_384(split): # (Both of those invocation styles should be equivalent, so there is no parametrization from here on out) - cmdline = "extract -F babel-django.cfg --add-comments Translators: -o django232.pot %s ." % kwarg_text - - args = shlex.split(cmdline) - cli = CommandLineInterface() - cmdinst = cli._configure_command(cmdname=args[0], argv=args[1:]) + cmdinst = configure_cli_command( + "extract -F babel-django.cfg --add-comments Translators: -o django232.pot %s ." % kwarg_text + ) assert isinstance(cmdinst, extract_messages) assert set(cmdinst.keywords.keys()) == set(( '_', |