Skip to content

Commit 18ef7de

Browse files
merge from master again
2 parents e96cd51 + f7585c7 commit 18ef7de

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Bruno Oliveira
2323
Cal Leeming
2424
Carl Friedrich Bolz
2525
Charles Cloud
26+
Charnjit SiNGH (CCSJ)
2627
Chris Lamb
2728
Christian Theunert
2829
Christian Tismer

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,23 @@
102102
only ran once. Now a failure is raised. Fixes (`#460`_). Thanks to
103103
`@nikratio`_ for bug report, `@RedBeardCode`_ and `@tomviner`_ for PR.
104104

105+
* Create correct diff for strings ending with newlines. Fixes (`#1553`_).
106+
Thanks `@Vogtinator`_ for reporting. Thanks to `@RedBeardCode`_ and
107+
`@tomviner`_ for PR.
108+
109+
*
110+
105111
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
106112
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
107113
.. _#1597: https://github.com/pytest-dev/pytest/pull/1597
108114
.. _#460: https://github.com/pytest-dev/pytest/pull/460
115+
.. _#1553: https://github.com/pytest-dev/pytest/issues/1553
109116

110117
.. _@graingert: https://github.com/graingert
111118
.. _@taschini: https://github.com/taschini
112119
.. _@nikratio: https://github.com/nikratio
113120
.. _@RedBeardCode: https://github.com/RedBeardCode
121+
.. _@Vogtinator: https://github.com/Vogtinator
114122

115123
* Fix `#1421`_: Exit tests if a collection error occurs and add
116124
``--continue-on-collection-errors`` option to restore previous behaviour.

_pytest/assertion/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,10 @@ def _diff_text(left, right, verbose=False):
225225
'characters in diff, use -v to show') % i]
226226
left = left[:-i]
227227
right = right[:-i]
228+
keepends = True
228229
explanation += [line.strip('\n')
229-
for line in ndiff(left.splitlines(),
230-
right.splitlines())]
230+
for line in ndiff(left.splitlines(keepends),
231+
right.splitlines(keepends))]
231232
return explanation
232233

233234

doc/en/cache.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ Inspecting Cache content
222222
-------------------------------
223223

224224
You can always peek at the content of the cache using the
225-
``--cache-clear`` command line option::
225+
``--cache-show`` command line option::
226226

227-
$ pytest --cache-clear
227+
$ py.test --cache-show
228228
======= test session starts ========
229229
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
230230
rootdir: $REGENDOC_TMPDIR, inifile:

testing/python/fixture.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,20 @@ def test_func(something): pass
490490
print(ss.stack)
491491
assert teardownlist == [1]
492492

493+
def test_mark_as_fixture_with_prefix_and_decorator_fails(self, testdir):
494+
testdir.makeconftest("""
495+
import pytest
496+
497+
@pytest.fixture
498+
def pytest_funcarg__marked_with_prefix_and_decorator():
499+
pass
500+
""")
501+
result = testdir.runpytest_subprocess()
502+
assert result.ret != 0
503+
result.stdout.fnmatch_lines([
504+
"*AssertionError:*pytest_funcarg__marked_with_prefix_and_decorator*"
505+
])
506+
493507
def test_request_addfinalizer_failing_setup(self, testdir):
494508
testdir.makepyfile("""
495509
import pytest

testing/test_assertion.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def test_long():
428428
"*- 3",
429429
"*- 5",
430430
"*- 7",
431-
"*truncated (191 more lines)*use*-vv*",
431+
"*truncated (193 more lines)*use*-vv*",
432432
])
433433

434434

@@ -626,3 +626,17 @@ def __hash__(self):
626626
+ repr(3)
627627
""").strip()
628628
assert '\n'.join(expl) == dedent
629+
630+
def test_diff_newline_at_end(monkeypatch, testdir):
631+
testdir.makepyfile(r"""
632+
def test_diff():
633+
assert 'asdf' == 'asdf\n'
634+
""")
635+
636+
result = testdir.runpytest()
637+
result.stdout.fnmatch_lines(r"""
638+
*assert 'asdf' == 'asdf\n'
639+
* - asdf
640+
* + asdf
641+
* ? +
642+
""")

0 commit comments

Comments
 (0)