[Pytest-commit] commit/pytest: bubenkoff: Merged in blueyed/pytest/strip-docstrings-from-fixtures (pull request #260)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Mar 12 08:12:46 CET 2015


1 new commit in pytest:

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.


More information about the pytest-commit mailing list