예제 #1
0
 def per_task_partial_or_invalid_flags_print_all_flags(self):
     for flag in ('--arg1', '--otherarg'):
         for given in ('--ar', '--nope'):
             assert_contains(
                 _complete('multiple_args {0}'.format(given), 'foo'),
                 flag
             )
예제 #2
0
파일: runners.py 프로젝트: simudream/invoke
 def enabled_via_config(self):
     self._run("yup", settings={'run': {'echo': True}})
     assert_contains(sys.stdout.getvalue(), "yup")
예제 #3
0
 def per_task_partial_or_invalid_flags_print_all_flags(self):
     for flag in ('--arg1', '--otherarg'):
         for given in ('--ar', '--nope'):
             assert_contains(
                 _complete('multiple-args {0}'.format(given), 'foo'), flag)
예제 #4
0
 def per_task_bool_flags_have_task_name_completion(self):
     assert_contains(_complete('basic-bool --mybool', 'foo'), 'mytask')
예제 #5
0
 def tasks_with_positional_args_complete_with_flags(self):
     # Because otherwise completing them is invalid anyways.
     # NOTE: this currently duplicates another test because this test cares
     # about a specific detail.
     output = _complete('print-name --', 'integration')
     assert_contains(output, '--name')
예제 #6
0
 def per_task_flags_complete_with_double_dashes(self):
     output = _complete('print-name --', 'integration')
     assert_contains(output, '--name')
     assert_not_contains(output, '-n\n')  # newline because -n is in --name
예제 #7
0
 def task_name_completion_includes_tasks_already_seen(self):
     # Because it's valid to call the same task >1 time.
     assert_contains(_complete('print-foo', 'integration'), 'print-foo')
예제 #8
0
 def top_level_with_dash_means_core_options(self):
     output = _complete('-')
     # No point mirroring all core options, just spot check a few
     for flag in ('--no-dedupe', '-d', '--debug', '-V', '--version'):
         assert_contains(output, "{0}\n".format(flag))
예제 #9
0
 def flag_completion_includes_inverse_booleans(self):
     output = _complete('basic_bool -', 'foo')
     assert_contains(output, '--no-mybool')
예제 #10
0
 def per_task_flags_complete_with_double_dashes(self):
     output = _complete('print_name --', 'integration')
     assert_contains(output, '--name')
     assert_not_contains(output, '-n\n') # newline because -n is in --name
예제 #11
0
 def per_task_flags_complete_with_single_dashes(self):
     for flag in ('--name', '-n'):
         assert_contains(_complete('print_name -', 'integration'), flag)
예제 #12
0
 def task_name_completion_includes_tasks_already_seen(self):
     # Because it's valid to call the same task >1 time.
     assert_contains(_complete('print_foo', 'integration'), 'print_foo')
예제 #13
0
 def task_names_only_complete_other_task_names(self):
     # Because only tokens starting with a dash should result in options.
     assert_contains(_complete('print_foo', 'integration'), 'print_name')
예제 #14
0
 def bare_double_dash_shows_only_long_core_options(self):
     output = _complete('--')
     assert_contains(output, '--no-dedupe')
     assert_not_contains(output, '-V')
예제 #15
0
파일: program.py 프로젝트: thebjorn/invoke
 def use_binary_basename_when_invoked_absolutely(self):
     Program().run("/usr/local/bin/myapp --help", exit=False)
     stdout = sys.stdout.getvalue()
     assert_contains(stdout, "myapp [--core-opts]")
     assert_not_contains(stdout, "/usr/local/bin")
예제 #16
0
 def enabled_via_config(self):
     self._run("yup", settings={'run': {'echo': True}})
     assert_contains(sys.stdout.getvalue(), "yup")
예제 #17
0
 def tasks_with_positional_args_complete_with_flags(self):
     # Because otherwise completing them is invalid anyways.
     # NOTE: this currently duplicates another test because this test cares
     # about a specific detail.
     output = _complete('print_name --', 'integration')
     assert_contains(output, '--name')
예제 #18
0
 def task_names_only_complete_other_task_names(self):
     # Because only tokens starting with a dash should result in options.
     assert_contains(_complete('print-foo', 'integration'), 'print-name')
예제 #19
0
 def core_bool_flags_have_task_name_completion(self):
     assert_contains(_complete('--echo', 'foo'), 'mytask')
예제 #20
0
 def per_task_flags_complete_with_single_dashes(self):
     for flag in ('--name', '-n'):
         assert_contains(_complete('print-name -', 'integration'), flag)
예제 #21
0
 def per_task_bool_flags_have_task_name_completion(self):
     assert_contains(_complete('basic_bool --mybool', 'foo'), 'mytask')
예제 #22
0
 def flag_completion_includes_inverse_booleans(self):
     output = _complete('basic-bool -', 'foo')
     assert_contains(output, '--no-mybool')
예제 #23
0
 def core_partial_or_invalid_flags_print_all_flags(self):
     for flag in ('--echo', '--complete'):
         for given in ('--e', '--nope'):
             assert_contains(_complete(given), flag)
예제 #24
0
 def core_bool_flags_have_task_name_completion(self):
     assert_contains(_complete('--echo', 'foo'), 'mytask')
예제 #25
0
 def reprompts_on_bad_input(self, mock_input):
     ok_(confirm("O rly?") is True)
     assert_contains(sys.stderr.getvalue(), "I didn't understand you")
예제 #26
0
 def core_partial_or_invalid_flags_print_all_flags(self):
     for flag in ('--echo', '--complete'):
         for given in ('--e', '--nope'):
             assert_contains(_complete(given), flag)
예제 #27
0
 def reprompts_on_bad_input(self, mock_input):
     ok_(confirm("O rly?") is True)
     assert_contains(sys.stderr.getvalue(), "I didn't understand you")
예제 #28
0
파일: runners.py 프로젝트: simudream/invoke
 def enabled_via_kwarg(self):
     self._run("my command", echo=True)
     assert_contains(sys.stdout.getvalue(), "my command")
예제 #29
0
 def task_name_completion_includes_aliases(self):
     for name in ('z\n', 'toplevel'):
         assert_contains(_complete('', 'alias_sorting'), name)
예제 #30
0
파일: runners.py 프로젝트: simudream/invoke
 def kwarg_beats_config(self):
     self._run("yup", echo=True, settings={'run': {'echo': False}})
     assert_contains(sys.stdout.getvalue(), "yup")
예제 #31
0
 def top_level_with_dash_means_core_options(self):
     output = _complete('-')
     # No point mirroring all core options, just spot check a few
     for flag in ('--no-dependencies', '-d', '--debug', '-V', '--version'):
         assert_contains(output, "{0}\n".format(flag))
예제 #32
0
 def enabled_via_kwarg(self):
     self._run("my command", echo=True)
     assert_contains(sys.stdout.getvalue(), "my command")
예제 #33
0
 def bare_double_dash_shows_only_long_core_options(self):
     output = _complete('--')
     assert_contains(output, '--no-dependencies')
     assert_not_contains(output, '-V')
예제 #34
0
 def kwarg_beats_config(self):
     self._run("yup", echo=True, settings={'run': {'echo': False}})
     assert_contains(sys.stdout.getvalue(), "yup")
예제 #35
0
 def task_name_completion_includes_aliases(self):
     for name in ('z\n', 'toplevel'):
         assert_contains(_complete('', 'alias_sorting'), name)