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

Comments

Projects
None yet
4 participants
@doerwalter
Copy link

doerwalter commented Jul 14, 2017

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

@MartinAltmayer

This comment has been minimized.

Copy link
Contributor

MartinAltmayer commented Jul 15, 2017

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

Merge pull request #2575 from MartinAltmayer/master
#2574 Options --fixtures and --fixtures-per-test keep indentation of docstrings

@nicoddemus nicoddemus closed this Jul 17, 2017

@nicoddemus

This comment has been minimized.

Copy link
Member

nicoddemus commented Jul 17, 2017

Fixed by #2575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.