예제 #1
0
파일: completion.py 프로젝트: melor/invoke
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})