Merged in blueyed/pytest/strip-docstrings-from-fixtures (pull request #260)
Strip docstrings in output with `--fixtures`
This commit is contained in:
commit
cdb46e9f16
|
@ -979,7 +979,7 @@ def _showfixtures_main(config, session):
|
||||||
loc = getlocation(fixturedef.func, curdir)
|
loc = getlocation(fixturedef.func, curdir)
|
||||||
doc = fixturedef.func.__doc__ or ""
|
doc = fixturedef.func.__doc__ or ""
|
||||||
if doc:
|
if doc:
|
||||||
for line in doc.split("\n"):
|
for line in doc.strip().split("\n"):
|
||||||
tw.line(" " + line.strip())
|
tw.line(" " + line.strip())
|
||||||
else:
|
else:
|
||||||
tw.line(" %s: no docstring available" %(loc,),
|
tw.line(" %s: no docstring available" %(loc,),
|
||||||
|
|
|
@ -500,7 +500,7 @@ class TestRequestBasic:
|
||||||
reprec.assertoutcome(passed=3)
|
reprec.assertoutcome(passed=3)
|
||||||
|
|
||||||
def test_fixtures_sub_subdir_normalize_sep(self, testdir):
|
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 = testdir.mkdir("tests").mkdir("unit")
|
||||||
b.join("conftest.py").write(py.code.Source("""
|
b.join("conftest.py").write(py.code.Source("""
|
||||||
def pytest_funcarg__arg1():
|
def pytest_funcarg__arg1():
|
||||||
|
@ -2323,6 +2323,36 @@ class TestShowFixtures:
|
||||||
*hello world*
|
*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:
|
class TestContextManagerFixtureFuncs:
|
||||||
|
|
Loading…
Reference in New Issue