Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndentationError on test run instead of pass/fail #56

Closed
kmantel opened this issue Dec 10, 2019 · 1 comment
Closed

IndentationError on test run instead of pass/fail #56

kmantel opened this issue Dec 10, 2019 · 1 comment

Comments

@kmantel
Copy link

kmantel commented Dec 10, 2019

../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/_pytest/runner.py:131: in pytest_runtest_call
    item.runtest()
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pytest_pydocstyle.py:72: in runtest
    ignore_decorators=ignore_decorators)]
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pytest_pydocstyle.py:71: in <listcomp>
    errors = [str(error) for error in pydocstyle.check((str(self.fspath),), select=checked_codes,
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:969: in check
    ignore_decorators):
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:123: in check_source
    for error in errors:
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:917: in check_docstring_sections
    yield from self._check_google_sections(lines, definition, docstring)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:903: in _check_google_sections
    yield from self._check_google_section(docstring, definition, ctx)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:796: in _check_google_section
    yield from cls._check_args_section(docstring, definition, context)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:748: in _check_args_section
    yield from ConventionChecker._check_missing_args(docstring_args, definition)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:762: in _check_missing_args
    function_args = get_function_args(definition.source)
../../.pyenv/versions/pnl375/lib/python3.7/site-packages/pydocstyle/checker.py:1002: in get_function_args
    function_arg_node = ast.parse(textwrap.dedent(function_string)).body[0].args
../../.pyenv/versions/3.7.5/lib/python3.7/ast.py:35: in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
E     File "<unknown>", line 1
E       def bar(self):
E       ^
E   IndentationError: unexpected indent

You can replicate it with a file containing

class Foo:

    def bar(self):
        """

        Arguments
        ---------

        """
        # a
# b

        pass

and you can avoid the error with several varying changes, like matching the indent of # b to # a, changing Arguments to something else (except Args), or removing the newlines in the docstring

kmantel added a commit to PrincetonUniversity/PsyNeuLink that referenced this issue Dec 10, 2019
@henry0312
Copy link
Owner

Thank you for your reporting, but it is the issue of pydocstyle, not pytest-docstyle.
Can you open a issue in pydocstyle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants