Prefect: Docs unit tests fail if an input argument has newlines

Created on 7 Jan 2019  路  4Comments  路  Source: PrefectHQ/prefect

This docstring creates a unit test failure, because of the newlines in the second-to-last argument. Interesting, if state_handlers is the LAST argument, no error is raised

"""
    Args:
        - flow (Flow): the `Flow` to be run
        - task_runner_cls (TaskRunner, optional): The class used for running
            individual Tasks. Defaults to [TaskRunner](task_runner.html)
        - state_handlers (Iterable[Callable], optional): A list of state change handlers
            that will be called whenever the flow changes state, providing an
            opportunity to inspect or modify the new state. The handler
            will be passed the flow runner instance, the old (prior) state, and the new
            (current) state, with the following signature:

            ```
                state_handler(
                    flow_runner: FlowRunner,
                    old_state: State,
                    new_state: State) -> State
            ```

            If multiple functions are passed, then the `new_state` argument will be the
            result of the previous handler.
        - task_runner_state_handlers (Iterable[Callable], optional): A list of state change
            handlers that will be provided to the task_runner, and called whenever a task changes
            state.
"""
bug docs tooling good first issue

Most helpful comment

I can't express how happy I am that I just opened a bug report... for docs.

All 4 comments

I can't express how happy I am that I just opened a bug report... for docs.

Are the new lines necessary? This could get tricky quickly as the regex which detects arg lists ends at new lines (which makes sense to allow for notes, further comments, return sections, etc)

The interesting thing is the newlines are in the current code; I just added that task_runner_state_handlers bullet at the bottom.

Right, so the docs pick up the arg docstring until that newline, but not after it. I.e., what comes after that newline is not considered a part of the doc for that particular arg. (It still shows up in the docs of course but, without looking, I鈥檓 guessing it appears with slightly less indentation than you'd otherwise expect from an arg doc)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emcake picture emcake  路  3Comments

GZangl picture GZangl  路  3Comments

petermorrow picture petermorrow  路  3Comments

ponggung picture ponggung  路  3Comments

Trymzet picture Trymzet  路  4Comments