2 new commits in pytest: https://bitbucket.org/pytest-dev/pytest/commits/252c230133fd/ Changeset: 252c230133fd Branch: strip-docstrings-from-fixtures User: blueyed Date: 2015-03-04 16:00:24+00:00 Summary: Strip docstrings in output with `--fixtures`
Fixes https://bitbucket.org/pytest-dev/pytest/issue/550. Affected #: 2 files diff -r e26175bf8246f01fc5573e92359b3124624c31b7 -r 252c230133fd19679e56e855bff4284786feaed1 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -979,7 +979,7 @@ loc = getlocation(fixturedef.func, curdir) doc = fixturedef.func.__doc__ or "" if doc: - for line in doc.split("\n"): + for line in doc.strip().split("\n"): tw.line(" " + line.strip()) else: tw.line(" %s: no docstring available" %(loc,), diff -r e26175bf8246f01fc5573e92359b3124624c31b7 -r 252c230133fd19679e56e855bff4284786feaed1 testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -500,7 +500,7 @@ reprec.assertoutcome(passed=3) def test_fixtures_sub_subdir_normalize_sep(self, testdir): - # this tests that normlization of nodeids takes place + # this tests that normalization of nodeids takes place b = testdir.mkdir("tests").mkdir("unit") b.join("conftest.py").write(py.code.Source(""" def pytest_funcarg__arg1(): @@ -2323,6 +2323,36 @@ *hello world* """) + def test_show_fixtures_trimmed_doc(self, testdir): + p = testdir.makepyfile(''' + import pytest + @pytest.fixture + def arg1(): + """ + line1 + line2 + + """ + @pytest.fixture + def arg2(): + """ + line1 + line2 + + """ + ''') + result = testdir.runpytest("--fixtures", p) + mark = dedent(""" + ------------- fixtures defined from test_show_fixtures_trimmed_doc ------------- + arg2 + line1 + line2 + arg1 + line1 + line2 + + """) + assert mark in result.stdout.str() class TestContextManagerFixtureFuncs: https://bitbucket.org/pytest-dev/pytest/commits/0bbfc95355d7/ Changeset: 0bbfc95355d7 User: bubenkoff Date: 2015-03-12 07:12:43+00:00 Summary: Merged in blueyed/pytest/strip-docstrings-from-fixtures (pull request #260) Strip docstrings in output with `--fixtures` Affected #: 2 files diff -r 9789d975ff2b60c072739800815f9ee0acef9408 -r 0bbfc95355d7edf5cb0078bfe9a28b2a11657d13 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -979,7 +979,7 @@ loc = getlocation(fixturedef.func, curdir) doc = fixturedef.func.__doc__ or "" if doc: - for line in doc.split("\n"): + for line in doc.strip().split("\n"): tw.line(" " + line.strip()) else: tw.line(" %s: no docstring available" %(loc,), diff -r 9789d975ff2b60c072739800815f9ee0acef9408 -r 0bbfc95355d7edf5cb0078bfe9a28b2a11657d13 testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -500,7 +500,7 @@ reprec.assertoutcome(passed=3) def test_fixtures_sub_subdir_normalize_sep(self, testdir): - # this tests that normlization of nodeids takes place + # this tests that normalization of nodeids takes place b = testdir.mkdir("tests").mkdir("unit") b.join("conftest.py").write(py.code.Source(""" def pytest_funcarg__arg1(): @@ -2323,6 +2323,36 @@ *hello world* """) + def test_show_fixtures_trimmed_doc(self, testdir): + p = testdir.makepyfile(''' + import pytest + @pytest.fixture + def arg1(): + """ + line1 + line2 + + """ + @pytest.fixture + def arg2(): + """ + line1 + line2 + + """ + ''') + result = testdir.runpytest("--fixtures", p) + mark = dedent(""" + ------------- fixtures defined from test_show_fixtures_trimmed_doc ------------- + arg2 + line1 + line2 + arg1 + line1 + line2 + + """) + assert mark in result.stdout.str() class TestContextManagerFixtureFuncs: Repository URL: https://bitbucket.org/pytest-dev/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit