Merge branch 'mark_missing_fixture_error' of https://github.com/eolo999/pytest

This commit is contained in:
Bruno Oliveira 2016-07-25 18:20:17 -03:00
commit 8f29ce26e9
5 changed files with 18 additions and 5 deletions

View File

@ -37,6 +37,7 @@ David Vierra
Diego Russo Diego Russo
Dmitry Dygalo Dmitry Dygalo
Edison Gustavo Muenz Edison Gustavo Muenz
Edoardo Batini
Eduardo Schettino Eduardo Schettino
Elizaveta Shashkova Elizaveta Shashkova
Endre Galaczi Endre Galaczi

View File

@ -3,6 +3,10 @@
**Bug Fixes** **Bug Fixes**
* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr.
Fixes `#717`_. Thanks `@blueyed`_ for reporting, `@eolo999`_ for the PR
and `@tomviner`_ for his guidance during EuroPython2016 sprint.
* Text documents without any doctests no longer appear as "skipped". * Text documents without any doctests no longer appear as "skipped".
Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).
@ -54,6 +58,7 @@
* Fixed collection of classes with custom ``__new__`` method. * Fixed collection of classes with custom ``__new__`` method.
Fixes `#1579`_. Thanks to `@Stranger6667`_ for the PR. Fixes `#1579`_. Thanks to `@Stranger6667`_ for the PR.
.. _#717: https://github.com/pytest-dev/pytest/issues/717
.. _#1579: https://github.com/pytest-dev/pytest/issues/1579 .. _#1579: https://github.com/pytest-dev/pytest/issues/1579
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580 .. _#1580: https://github.com/pytest-dev/pytest/pull/1580
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605 .. _#1605: https://github.com/pytest-dev/pytest/issues/1605
@ -66,6 +71,8 @@
.. _#925: https://github.com/pytest-dev/pytest/issues/925 .. _#925: https://github.com/pytest-dev/pytest/issues/925
.. _#1210: https://github.com/pytest-dev/pytest/issues/1210 .. _#1210: https://github.com/pytest-dev/pytest/issues/1210
.. _@eolo999: https://github.com/eolo999
.. _@blueyed: https://github.com/blueyed
.. _@graingert: https://github.com/graingert .. _@graingert: https://github.com/graingert
.. _@taschini: https://github.com/taschini .. _@taschini: https://github.com/taschini
.. _@nikratio: https://github.com/nikratio .. _@nikratio: https://github.com/nikratio

View File

@ -1842,8 +1842,13 @@ class FixtureLookupErrorRepr(TerminalRepr):
#tw.line("FixtureLookupError: %s" %(self.argname), red=True) #tw.line("FixtureLookupError: %s" %(self.argname), red=True)
for tbline in self.tblines: for tbline in self.tblines:
tw.line(tbline.rstrip()) tw.line(tbline.rstrip())
for line in self.errorstring.split("\n"): lines = self.errorstring.split("\n")
tw.line(" " + line.strip(), red=True) for line in lines:
if line == lines[0]:
prefix = 'E '
else:
prefix = ' '
tw.line(prefix + line.strip(), red=True)
tw.line() tw.line()
tw.line("%s:%d" % (self.filename, self.firstlineno+1)) tw.line("%s:%d" % (self.filename, self.firstlineno+1))

View File

@ -376,7 +376,7 @@ class TestGeneralUsage:
res = testdir.runpytest(p) res = testdir.runpytest(p)
res.stdout.fnmatch_lines([ res.stdout.fnmatch_lines([
"*source code not available*", "*source code not available*",
"*fixture 'invalid_fixture' not found", "E*fixture 'invalid_fixture' not found",
]) ])
def test_plugins_given_as_strings(self, tmpdir, monkeypatch): def test_plugins_given_as_strings(self, tmpdir, monkeypatch):

View File

@ -416,9 +416,9 @@ class TestCaptureFixture:
result = testdir.runpytest(p) result = testdir.runpytest(p)
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*ERROR*setup*test_one*", "*ERROR*setup*test_one*",
"*capsys*capfd*same*time*", "E*capsys*capfd*same*time*",
"*ERROR*setup*test_two*", "*ERROR*setup*test_two*",
"*capsys*capfd*same*time*", "E*capsys*capfd*same*time*",
"*2 error*"]) "*2 error*"])
@pytest.mark.parametrize("method", ["sys", "fd"]) @pytest.mark.parametrize("method", ["sys", "fd"])