示例#1
0
def _complete(invocation, collection=None):
    colstr = ""
    if collection:
        colstr = "-c {0}".format(collection)
    with expect_exit(0):
        _dispatch("inv --complete {1} -- inv {0}".format(invocation, colstr))
    return sys.stdout.getvalue()
示例#2
0
def _complete(invocation, collection=None):
    colstr = ""
    if collection:
        colstr = "-c {0}".format(collection)
    with expect_exit(0):
        _dispatch("inv --complete {1} -- inv {0}".format(invocation, colstr))
    return sys.stdout.getvalue()
示例#3
0
 def should_not_show_tracebacks(self):
     # Ensure we fall out of dispatch() on missing parser args,
     # but are still able to look at stderr to ensure no TB got printed
     with patch('sys.exit', Mock(side_effect=SystemExit)):
         try:
             _dispatch("inv -c fail missing_pos")
         except SystemExit:
             pass
         assert TB_SENTINEL not in sys.stderr.getvalue()
示例#4
0
文件: cli.py 项目: kejbaly2/invoke
 def should_not_show_tracebacks(self):
     # Ensure we fall out of dispatch() on missing parser args,
     # but are still able to look at stderr to ensure no TB got printed
     with patch('sys.exit', Mock(side_effect=SystemExit)):
         try:
             _dispatch("inv -c fail missing_pos")
         except SystemExit:
             pass
         assert TB_SENTINEL not in sys.stderr.getvalue()
示例#5
0
文件: cli.py 项目: pombredanne/invoke
 def collection_defaults_dont_block_env_var_run_settings(self):
     # Environ setting run.warn
     os.environ['INVOKE_RUN_WARN'] = "1"
     with run_in_configs() as run:
         # This collection sets run = {echo: true}
         # If merging isn't done, it will overwrite the low level
         # defaults, meaning the env var adapter won't see that
         # 'run_warn' is a valid setting.
         _dispatch('invoke -c collection go')
         ok_(run.call_args[1]['echo'] == True)
         ok_(run.call_args[1]['warn'] == True)
示例#6
0
 def collection_defaults_dont_block_env_var_run_settings(self):
     # Environ setting run.warn
     os.environ['INVOKE_RUN_WARN'] = "1"
     with run_in_configs() as run:
         # This collection sets run = {echo: true}
         # If merging isn't done, it will overwrite the low level
         # defaults, meaning the env var adapter won't see that
         # 'run_warn' is a valid setting.
         _dispatch('invoke -c collection go')
         ok_(run.call_args[1]['echo'] == True)
         ok_(run.call_args[1]['warn'] == True)
示例#7
0
 def run_echo_honors_configuration_overrides(self):
     # Try a few realistic-for-this-setting levels:
     with run_in_configs() as run:
         # Collection
         _dispatch('invoke -c collection go')
         eq_(run.call_args_list[-1][1]['echo'], True)
         # Runtime conf file
         _dispatch('invoke -c contextualized -f echo.yaml run')
         eq_(run.call_args_list[-1][1]['echo'], True)
         # Runtime beats collection
         _dispatch('invoke -c collection -f no-echo.yaml go')
         eq_(run.call_args_list[-1][1]['echo'], False)
         # Flag beats runtime
         _dispatch('invoke -c contextualized -f no-echo.yaml -e run')
         eq_(run.call_args_list[-1][1]['echo'], True)
示例#8
0
文件: cli.py 项目: pombredanne/invoke
 def run_echo_honors_configuration_overrides(self):
     # Try a few realistic-for-this-setting levels:
     with run_in_configs() as run:
         # Collection
         _dispatch('invoke -c collection go')
         eq_(run.call_args_list[-1][1]['echo'], True)
         # Runtime conf file
         _dispatch('invoke -c contextualized -f echo.yaml run')
         eq_(run.call_args_list[-1][1]['echo'], True)
         # Runtime beats collection
         _dispatch('invoke -c collection -f no-echo.yaml go')
         eq_(run.call_args_list[-1][1]['echo'], False)
         # Flag beats runtime
         _dispatch('invoke -c contextualized -f no-echo.yaml -e run')
         eq_(run.call_args_list[-1][1]['echo'], True)
示例#9
0
 def contextualized_tasks_are_given_parser_context_arg(self):
     # go() in contextualized.py just returns its initial arg
     retval = list(_dispatch('invoke -c contextualized go').values())[0]
     assert isinstance(retval, Context)
示例#10
0
文件: cli.py 项目: kejbaly2/invoke
 def missing_default_task_prints_help(self):
     with expect_exit():
         _dispatch("inv -c foo")
     ok_("Core options:" in sys.stdout.getvalue())
示例#11
0
文件: cli.py 项目: melor/invoke
 def _test_flag(self, flag, key):
     with mocked_run():
         # The tasks themselves perform the necessary asserts.
         _dispatch('invoke {0} -c contextualized check_{1}'.format(
             flag, key))
示例#12
0
文件: cli.py 项目: kejbaly2/invoke
 def runtime_config_file_honored(self):
     with cd('configs'):
         _dispatch("inv -c runtime -f yaml/invoke.yaml mytask")
示例#13
0
文件: cli.py 项目: kejbaly2/invoke
 def command_failure(self):
     "Command failure doesn't show tracebacks"
     with patch('sys.exit') as exit:
         _dispatch('inv -c fail simple')
         assert TB_SENTINEL not in sys.stderr.getvalue()
         exit.assert_called_with(1)
示例#14
0
文件: cli.py 项目: kejbaly2/invoke
 def vanilla(self):
     os.chdir('implicit')
     _dispatch('inv foo')
     eq_(sys.stdout.getvalue(), "Hm\n")
示例#15
0
 def per_project_config_files_load_with_explicit_ns(self):
     # Re: #234
     with cd(os.path.join('configs', 'yaml')):
         _dispatch("inv -c explicit mytask")
示例#16
0
 def vanilla_with_explicit_collection(self):
     # Duplicates _output_eq, but this way that can change w/o breaking
     # our expectations.
     _dispatch('inv -c integration print_foo')
     eq_(sys.stdout.getvalue(), "foo\n")
示例#17
0
 def runtime_config_file_honored(self):
     with cd('configs'):
         _dispatch("inv -c runtime -f yaml/invoke.yaml mytask")
示例#18
0
 def _test_flag(self, flag, kwarg, value):
     with patch('invoke.context.run') as run:
         _dispatch('invoke {0} -c contextualized run'.format(flag))
         ok_(run.call_args[1][kwarg] == value)
示例#19
0
 def per_project_config_files_are_loaded(self):
     with cd(os.path.join('configs', 'yaml')):
         _dispatch("inv mytask")
示例#20
0
 def debug_flag_activates_logging(self):
     # Have to patch our logger to get in before Nose logcapture kicks in.
     with patch('invoke.util.debug') as debug:
         _dispatch('inv -d -c debugging foo')
         debug.assert_called_with('my-sentinel')
示例#21
0
 def vanilla(self):
     os.chdir('implicit')
     _dispatch('inv foo')
     eq_(sys.stdout.getvalue(), "Hm\n")
示例#22
0
 def version_override(self):
     with expect_exit():
         _dispatch('notinvoke -V', version="nope 1.0")
     eq_(sys.stdout.getvalue(), "nope 1.0\n")
示例#23
0
文件: cli.py 项目: B-Rich/invoke
 def _test_flag(self, flag, kwarg, value):
     with patch('invoke.context.run') as run:
         _dispatch('invoke {0} -c contextualized run'.format(flag))
         run.assert_called_with('x', **{kwarg: value})
示例#24
0
文件: cli.py 项目: kejbaly2/invoke
 def _test_flag(self, flag, key):
     with mocked_run():
         # The tasks themselves perform the necessary asserts.
         _dispatch('invoke {0} -c contextualized check_{1}'.format(
             flag, key
         ))
示例#25
0
文件: cli.py 项目: kejbaly2/invoke
 def version_override(self):
     with expect_exit():
         _dispatch('notinvoke -V', version="nope 1.0")
     eq_(sys.stdout.getvalue(), "nope 1.0\n")
示例#26
0
文件: cli.py 项目: kejbaly2/invoke
 def per_project_config_files_are_loaded(self):
     with cd(os.path.join('configs', 'yaml')):
         _dispatch("inv mytask")
示例#27
0
文件: cli.py 项目: kejbaly2/invoke
 def debug_flag_activates_logging(self):
     # Have to patch our logger to get in before Nose logcapture kicks in.
     with patch('invoke.util.debug') as debug:
         _dispatch('inv -d -c debugging foo')
         debug.assert_called_with('my-sentinel')
示例#28
0
文件: cli.py 项目: melor/invoke
 def env_vars_load_with_prefix(self):
     os.environ['INVOKE_RUN_ECHO'] = "1"
     with mocked_run():
         # Task performs the assert
         _dispatch('invoke -c contextualized check_echo')
示例#29
0
文件: cli.py 项目: kejbaly2/invoke
 def vanilla_with_explicit_collection(self):
     # Duplicates _output_eq, but this way that can change w/o breaking
     # our expectations.
     _dispatch('inv -c integration print_foo')
     eq_(sys.stdout.getvalue(), "foo\n")
示例#30
0
 def env_vars_load_with_prefix(self):
     os.environ['INVOKE_RUN_ECHO'] = "1"
     with patch('invoke.context.run') as run:
         _dispatch('invoke -c contextualized run')
         ok_(run.call_args[1]['echo'] == True)
示例#31
0
文件: cli.py 项目: kejbaly2/invoke
 def per_project_config_files_load_with_explicit_ns(self):
     # Re: #234
     with cd(os.path.join('configs', 'yaml')):
         _dispatch("inv -c explicit mytask")
示例#32
0
文件: cli.py 项目: pombredanne/invoke
 def _test_flag(self, flag, kwarg, value):
     with patch('invoke.context.run') as run:
         _dispatch('invoke {0} -c contextualized run'.format(flag))
         ok_(run.call_args[1][kwarg] == value)
示例#33
0
文件: cli.py 项目: kejbaly2/invoke
 def env_vars_load_with_prefix(self):
     os.environ['INVOKE_RUN_ECHO'] = "1"
     with mocked_run():
         # Task performs the assert
         _dispatch('invoke -c contextualized check_echo')
示例#34
0
 def command_failure(self):
     "Command failure doesn't show tracebacks"
     with patch('sys.exit') as exit:
         _dispatch('inv -c fail simple')
         assert TB_SENTINEL not in sys.stderr.getvalue()
         exit.assert_called_with(1)
示例#35
0
文件: cli.py 项目: pombredanne/invoke
 def env_vars_load_with_prefix(self):
     os.environ['INVOKE_RUN_ECHO'] = "1"
     with patch('invoke.context.run') as run:
         _dispatch('invoke -c contextualized run')
         ok_(run.call_args[1]['echo'] == True)
示例#36
0
 def missing_default_task_prints_help(self):
     with expect_exit():
         _dispatch("inv -c foo")
     ok_("Core options:" in sys.stdout.getvalue())
示例#37
0
文件: cli.py 项目: kejbaly2/invoke
 def contextualized_tasks_are_given_parser_context_arg(self):
     # go() in contextualized.py just returns its initial arg
     retval = list(_dispatch('invoke -c contextualized go').values())[0]
     assert isinstance(retval, Context)
示例#38
0
文件: cli.py 项目: vhbit/invoke
 def _test_flag(self, flag, kwarg, value):
     with patch('invoke.context.run') as run:
         _dispatch('invoke {0} -c contextualized run'.format(flag))
         run.assert_called_with('x', **{kwarg: value})