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

pytest --fixtures drops indentation from fixture docstring #2574

Closed
doerwalter opened this issue Jul 14, 2017 · 2 comments
Closed

pytest --fixtures drops indentation from fixture docstring #2574

doerwalter opened this issue Jul 14, 2017 · 2 comments
Labels
good first issue easy issue that is friendly to new contributor topic: fixtures anything involving fixtures directly or indirectly topic: reporting related to terminal output and user-facing messages and errors

Comments

@doerwalter
Copy link

When a fixture docstring has varying levels of indentation pytest --fixtures drops the indentation completely. For example:

import pytest

@pytest.fixture(scope="module")
def foo(request):
   """
   Use the foo to foo the foo like this::

      foo("foo")
   """

calling python -mpytest test_foo.py --fixtures outputs:

================= test session starts ======================
...
------------ fixtures defined from test_foo ----------------
foo
    Use the foo to foo the foo like this::

    foo("foo")
=============== no tests ran in 0.03 seconds ===============

However I would have expected this to output:

================= test session starts ======================
...
------------ fixtures defined from test_foo ----------------
foo
    Use the foo to foo the foo like this::

       foo("foo")
=============== no tests ran in 0.03 seconds ===============

i.e. only the smallest indentation level should be stripped away (except maybe for the first line that requires special treatment).

@doerwalter doerwalter changed the title pytest --fixtures drop indentation from fixture docstring pytest --fixtures drops indentation from fixture docstring Jul 14, 2017
@flub flub added good first issue easy issue that is friendly to new contributor topic: fixtures anything involving fixtures directly or indirectly topic: reporting related to terminal output and user-facing messages and errors labels Jul 15, 2017
@MartinAltmayer
Copy link
Contributor

This seems easy, I would like to work on it.

MartinAltmayer added a commit to MartinAltmayer/pytest that referenced this issue Jul 15, 2017
nicoddemus added a commit that referenced this issue Jul 17, 2017
#2574 Options --fixtures and --fixtures-per-test keep indentation of docstrings
@nicoddemus
Copy link
Member

Fixed by #2575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue easy issue that is friendly to new contributor topic: fixtures anything involving fixtures directly or indirectly topic: reporting related to terminal output and user-facing messages and errors
Projects
None yet
Development

No branches or pull requests

4 participants