Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start first line of FixtureLookupErrorRepr messages with an 'E' #1762

Merged
merged 8 commits into from
Jul 25, 2016
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ David Díaz-Barquero
David Mohr
David Vierra
Edison Gustavo Muenz
Edoardo Batini
Eduardo Schettino
Elizaveta Shashkova
Endre Galaczi
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

**Bug Fixes**

* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr.
Fixes (`#717`_). Thanks `@blueyed`_ for reporting, `@eolo999`_ for the PR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you drop the parenthesis here? 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parenthesis removed and PR updated, thanks.

and `@tomviner`_ for his guidance during EuroPython2016 sprint.

* Text documents without any doctests no longer appear as "skipped".
Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).

Expand Down Expand Up @@ -49,6 +53,7 @@
* ImportErrors in plugins now are a fatal error instead of issuing a
pytest warning (`#1479`_). Thanks to `@The-Compiler`_ for the PR.

.. _#717: https://github.com/pytest-dev/pytest/issues/717
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
.. _#1597: https://github.com/pytest-dev/pytest/pull/1597
Expand All @@ -59,6 +64,8 @@
.. _#1479: https://github.com/pytest-dev/pytest/issues/1479
.. _#925: https://github.com/pytest-dev/pytest/issues/925

.. _@eolo999: https://github.com/eolo999
.. _@blueyed: https://github.com/blueyed
.. _@graingert: https://github.com/graingert
.. _@taschini: https://github.com/taschini
.. _@nikratio: https://github.com/nikratio
Expand Down
9 changes: 7 additions & 2 deletions _pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,13 @@ def toterminal(self, tw):
#tw.line("FixtureLookupError: %s" %(self.argname), red=True)
for tbline in self.tblines:
tw.line(tbline.rstrip())
for line in self.errorstring.split("\n"):
tw.line(" " + line.strip(), red=True)
lines = self.errorstring.split("\n")
for line in lines:
if line == lines[0]:
prefix = 'E '
else:
prefix = ' '
tw.line(prefix + line.strip(), red=True)
tw.line()
tw.line("%s:%d" % (self.filename, self.firstlineno+1))

Expand Down
2 changes: 1 addition & 1 deletion testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_foo(invalid_fixture):
res = testdir.runpytest(p)
res.stdout.fnmatch_lines([
"*source code not available*",
"*fixture 'invalid_fixture' not found",
"E*fixture 'invalid_fixture' not found",
])

def test_plugins_given_as_strings(self, tmpdir, monkeypatch):
Expand Down
4 changes: 2 additions & 2 deletions testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ def test_two(capfd, capsys):
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*ERROR*setup*test_one*",
"*capsys*capfd*same*time*",
"E*capsys*capfd*same*time*",
"*ERROR*setup*test_two*",
"*capsys*capfd*same*time*",
"E*capsys*capfd*same*time*",
"*2 error*"])

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