From 6799a47c7884ded9001b08833307492b63468760 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:43:34 +0200 Subject: [PATCH 1/5] Start FixtureLookupErrorRepr with an 'E' --- _pytest/python.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_pytest/python.py b/_pytest/python.py index 6242fd49782..cc2dd64d3df 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -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)) From e9a67e6702c5780ab1fedf4de327214937590397 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:45:07 +0200 Subject: [PATCH 2/5] Adjust test involving FixtureLookupErrorRepr I added a starting 'E' to the expected error messages. The tests were still passing after the previous patch but I think it's better to have stricter tests. --- testing/acceptance_test.py | 2 +- testing/test_capture.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 1b14d12a5f6..8b7cca205cc 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -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): diff --git a/testing/test_capture.py b/testing/test_capture.py index 73660692b8e..ef561ab4fe5 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -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"]) From e00199212cab25f5581221a03180310dfe2a0e5f Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:49:44 +0200 Subject: [PATCH 3/5] Add myself to the AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index b459cef6ce8..b5dc2eb1ead 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,6 +35,7 @@ David Díaz-Barquero David Mohr David Vierra Edison Gustavo Muenz +Edoardo Batini Eduardo Schettino Elizaveta Shashkova Endre Galaczi From 3c4158ac350991b7164d23840490d68ea3ebba3a Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:51:11 +0200 Subject: [PATCH 4/5] Add changelog entry for this bugfix branch --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e55acbbcf2..ca911ffaf1c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,9 @@ **Bug Fixes** +* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr. + Fixes (`#717`_). Thanks `@blueyed`_ for reporting. + * Text documents without any doctests no longer appear as "skipped". Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). From fabe8cda2f9464412e4193a31fb6323d93ba191a Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:59:34 +0200 Subject: [PATCH 5/5] Thanking myself in CHANGELOG --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ca911ffaf1c..728c86ca316 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ **Bug Fixes** * Add an 'E' to the first line of error messages from FixtureLookupErrorRepr. - Fixes (`#717`_). Thanks `@blueyed`_ for reporting. + Fixes (`#717`_). Thanks `@blueyed`_ for reporting and `@eolo999`_ for the PR. * Text documents without any doctests no longer appear as "skipped". Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).