Beispiel #1
0
 def test_old_style_task_with_default_args(self):
     def task_old_style(arg1, arg2, arg3=None, arg4='yes'):
         '''Docstring'''
     details = get_task_details(task_old_style)
     eq_("Docstring\n"
         "Arguments: arg1, arg2, arg3=None, arg4='yes'",
         details)
Beispiel #2
0
 def test_old_style_task_without_args(self):
     def task_old_style():
         '''Docstring'''
     details = get_task_details(task_old_style)
     eq_("Docstring\n"
         "Arguments: ",
         details)
Beispiel #3
0
    def test_old_style_task_with_default_args(self):
        def task_old_style(arg1, arg2, arg3=None, arg4='yes'):
            '''Docstring'''

        details = get_task_details(task_old_style)
        eq_("Docstring\n"
            "Arguments: arg1, arg2, arg3=None, arg4='yes'", details)
Beispiel #4
0
 def __details__(self):
     with utils.patch(
             six.get_method_function(self.tasks.service.destroy),
             '__doc__',
             self.__doc__ + (self.tasks.service.destroy.__doc__ or ''),
     ):
         return get_task_details(self.tasks.service.destroy)
Beispiel #5
0
 def __details__(self):
     with utils.patch(
         six.get_method_function(self.tasks.service.destroy),
         '__doc__',
         self.__doc__ + (self.tasks.service.destroy.__doc__ or ''),
     ):
         return get_task_details(self.tasks.service.destroy)
Beispiel #6
0
    def test_old_style_task_without_args(self):
        """
        __details__() should print docstr for old style task methods without args
        """
        def task_old_style():
            '''Docstring'''

        details = get_task_details(task_old_style)
        eq_("Docstring\n" "Arguments: ", details)
Beispiel #7
0
 def test_old_style_task_with_default_args(self):
     """
     __details__() should print docstr for old style task methods with default args
     """
     def task_old_style(arg1, arg2, arg3=None, arg4='yes'):
         '''Docstring'''
     details = get_task_details(task_old_style)
     eq_("Docstring\n"
         "Arguments: arg1, arg2, arg3=None, arg4='yes'",
         details)
 def test_old_style_task_with_default_args(self):
     """
     __details__() should print docstr for old style task methods with default args
     """
     def task_old_style(arg1, arg2, arg3=None, arg4='yes'):
         '''Docstring'''
     details = get_task_details(task_old_style)
     eq_("Docstring\n"
         "Arguments: arg1, arg2, arg3=None, arg4='yes'",
         details)
Beispiel #9
0
    def test_old_style_task_without_args(self):
        """
        __details__() should print docstr for old style task methods without args
        """

        def task_old_style():
            """Docstring"""

        details = get_task_details(task_old_style)
        eq_("Docstring\n" "Arguments: ", details)
Beispiel #10
0
def display_command(name):
    """
    Print command function's docstring, then exit. Invoked with -d/--display.
    """
    # Sanity check
    command = crawl(name, state.commands)
    if command is None:
        msg = "Task '%s' does not appear to exist. Valid task names:\n%s"
        abort(msg % (name, "\n".join(_normal_list(False))))
    # Print out nicely presented docstring if found
    if hasattr(command, '__details__'):
        task_details = command.__details__()
    else:
        task_details = get_task_details(command)
    if task_details:
        print("Displaying detailed information for task '%s':" % name)
        print('')
        print(indent(task_details, strip=True))
        print('')
    # Or print notice if not
    else:
        print("No detailed information available for task '%s':" % name)
    sys.exit(0)
Beispiel #11
0
def display_command(name):
    """
    Print command function's docstring, then exit. Invoked with -d/--display.
    """
    # Sanity check
    command = crawl(name, state.commands)
    if command is None:
        msg = "Task '%s' does not appear to exist. Valid task names:\n%s"
        abort(msg % (name, "\n".join(_normal_list(False))))
    # Print out nicely presented docstring if found
    if hasattr(command, '__details__'):
        task_details = command.__details__()
    else:
        task_details = get_task_details(command)
    if task_details:
        print("Displaying detailed information for task '%s':" % name)
        print('')
        print(indent(task_details, strip=True))
        print('')
    # Or print notice if not
    else:
        print("No detailed information available for task '%s':" % name)
    sys.exit(0)
Beispiel #12
0
    def test_old_style_task_without_args(self):
        def task_old_style():
            '''Docstring'''

        details = get_task_details(task_old_style)
        eq_("Docstring\n" "Arguments: ", details)
Beispiel #13
0
 def _details():
     return get_task_details(wrapped)
Beispiel #14
0
 def __details__(self):
     doc = self.__doc__ + (self.callback.__doc__ or '')
     with utils.patch(self.callback, '__doc__', doc):
         return get_task_details(self.callback)
Beispiel #15
0
 def __details__(self):
     doc = self.__doc__ + (self.callback.__doc__ or '')
     with utils.patch(self.callback, '__doc__', doc):
         return get_task_details(self.callback)