Fix lineno offset in show_skipped

The line number is 0-based here, so add 1.
This commit is contained in:
Daniel Hahler 2017-07-04 12:57:15 +02:00
parent 70d9f8638f
commit 869eed9898
3 changed files with 3 additions and 2 deletions

View File

@ -382,4 +382,4 @@ def show_skipped(terminalreporter, lines):
reason = reason[9:]
lines.append(
"SKIP [%d] %s:%d: %s" %
(num, fspath, lineno, reason))
(num, fspath, lineno + 1, reason))

1
changelog/2548.bugfix Normal file
View File

@ -0,0 +1 @@
Fix lineno offset in show_skipped.

View File

@ -708,7 +708,7 @@ def test_skipped_reasons_functional(testdir):
)
result = testdir.runpytest('-rs')
result.stdout.fnmatch_lines([
"*SKIP*2*conftest.py:3: test",
"*SKIP*2*conftest.py:4: test",
])
assert result.ret == 0