Skip to content

Commit 8f29ce2

Browse files
committed
Merge branch 'mark_missing_fixture_error' of https://github.com/eolo999/pytest
2 parents a2b04d0 + e9d729b commit 8f29ce2

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ David Vierra
3737
Diego Russo
3838
Dmitry Dygalo
3939
Edison Gustavo Muenz
40+
Edoardo Batini
4041
Eduardo Schettino
4142
Elizaveta Shashkova
4243
Endre Galaczi

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
**Bug Fixes**
55

6+
* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr.
7+
Fixes `#717`_. Thanks `@blueyed`_ for reporting, `@eolo999`_ for the PR
8+
and `@tomviner`_ for his guidance during EuroPython2016 sprint.
9+
610
* Text documents without any doctests no longer appear as "skipped".
711
Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).
812

@@ -54,6 +58,7 @@
5458
* Fixed collection of classes with custom ``__new__`` method.
5559
Fixes `#1579`_. Thanks to `@Stranger6667`_ for the PR.
5660

61+
.. _#717: https://github.com/pytest-dev/pytest/issues/717
5762
.. _#1579: https://github.com/pytest-dev/pytest/issues/1579
5863
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
5964
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
@@ -66,6 +71,8 @@
6671
.. _#925: https://github.com/pytest-dev/pytest/issues/925
6772
.. _#1210: https://github.com/pytest-dev/pytest/issues/1210
6873

74+
.. _@eolo999: https://github.com/eolo999
75+
.. _@blueyed: https://github.com/blueyed
6976
.. _@graingert: https://github.com/graingert
7077
.. _@taschini: https://github.com/taschini
7178
.. _@nikratio: https://github.com/nikratio

_pytest/python.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,8 +1842,13 @@ def toterminal(self, tw):
18421842
#tw.line("FixtureLookupError: %s" %(self.argname), red=True)
18431843
for tbline in self.tblines:
18441844
tw.line(tbline.rstrip())
1845-
for line in self.errorstring.split("\n"):
1846-
tw.line(" " + line.strip(), red=True)
1845+
lines = self.errorstring.split("\n")
1846+
for line in lines:
1847+
if line == lines[0]:
1848+
prefix = 'E '
1849+
else:
1850+
prefix = ' '
1851+
tw.line(prefix + line.strip(), red=True)
18471852
tw.line()
18481853
tw.line("%s:%d" % (self.filename, self.firstlineno+1))
18491854

testing/acceptance_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_foo(invalid_fixture):
376376
res = testdir.runpytest(p)
377377
res.stdout.fnmatch_lines([
378378
"*source code not available*",
379-
"*fixture 'invalid_fixture' not found",
379+
"E*fixture 'invalid_fixture' not found",
380380
])
381381

382382
def test_plugins_given_as_strings(self, tmpdir, monkeypatch):

testing/test_capture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ def test_two(capfd, capsys):
416416
result = testdir.runpytest(p)
417417
result.stdout.fnmatch_lines([
418418
"*ERROR*setup*test_one*",
419-
"*capsys*capfd*same*time*",
419+
"E*capsys*capfd*same*time*",
420420
"*ERROR*setup*test_two*",
421-
"*capsys*capfd*same*time*",
421+
"E*capsys*capfd*same*time*",
422422
"*2 error*"])
423423

424424
@pytest.mark.parametrize("method", ["sys", "fd"])

0 commit comments

Comments
 (0)