From 6799a47c7884ded9001b08833307492b63468760 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sat, 23 Jul 2016 23:43:34 +0200 Subject: [PATCH 1/8] 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 6242fd497..cc2dd64d3 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1835,8 +1835,13 @@ class FixtureLookupErrorRepr(TerminalRepr): #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/8] 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 1b14d12a5..8b7cca205 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -376,7 +376,7 @@ class TestGeneralUsage: 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 73660692b..ef561ab4f 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -416,9 +416,9 @@ class TestCaptureFixture: 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/8] Add myself to the AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index b459cef6c..b5dc2eb1e 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/8] Add changelog entry for this bugfix branch --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e55acbbc..ca911ffaf 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/8] Thanking myself in CHANGELOG --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ca911ffaf..728c86ca3 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`_). From f450e0a1db5ccc6a55479f58d6755e8ec3dfd525 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sun, 24 Jul 2016 00:06:16 +0200 Subject: [PATCH 6/8] Thanks to Tom Viner for his guidance during EuroPython2016 sprint --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 728c86ca3..8b316f5ff 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,8 @@ **Bug Fixes** * Add an 'E' to the first line of error messages from FixtureLookupErrorRepr. - Fixes (`#717`_). Thanks `@blueyed`_ for reporting and `@eolo999`_ for the PR. + 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". Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). From 0ae77be9f0bf48c7484062a02f42cf256cebce96 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Sun, 24 Jul 2016 00:46:06 +0200 Subject: [PATCH 7/8] Add new target links in CHANGELOG --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8b316f5ff..d3d7c097e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -53,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 @@ -63,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 From e9d729bd46c10248d2a16eb8bd2f944bae7ecb82 Mon Sep 17 00:00:00 2001 From: Edoardo Batini Date: Mon, 25 Jul 2016 10:11:37 +0200 Subject: [PATCH 8/8] drop parenthesis around GH issue number --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d3d7c097e..e861df450 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, `@eolo999`_ for the PR + 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".