Fix off-by-one error with lines from request.node.warn
The line numbers in `node.location` seem to be zero-based?!
This commit is contained in:
@@ -525,13 +525,14 @@ class TestWarning:
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_warn_on_test_item_from_request(self, testdir):
|
||||
def test_warn_on_test_item_from_request(self, testdir, request):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def fix(request):
|
||||
request.node.warn("T1", "hello")
|
||||
|
||||
def test_hello(fix):
|
||||
pass
|
||||
""")
|
||||
@@ -542,7 +543,7 @@ class TestWarning:
|
||||
result = testdir.runpytest("-rw")
|
||||
result.stdout.fnmatch_lines("""
|
||||
===*pytest-warning summary*===
|
||||
*WT1*test_warn_on_test_item*:5*hello*
|
||||
*WT1*test_warn_on_test_item*:7 hello*
|
||||
""")
|
||||
|
||||
class TestRootdir:
|
||||
|
||||
Reference in New Issue
Block a user