File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 3
3
4
4
**Bug Fixes **
5
5
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.
6
+ * Improve error message with fixture lookup errors: add an 'E' to the first
7
+ line and '>' to the rest. Fixes `#717 `_. Thanks `@blueyed `_ for reporting and
8
+ a PR, `@eolo999 `_ for the initial PR and `@tomviner `_ for his guidance during
9
+ EuroPython2016 sprint.
9
10
10
11
* Text documents without any doctests no longer appear as "skipped".
11
12
Thanks `@graingert `_ for reporting and providing a full PR (`#1580 `_).
Original file line number Diff line number Diff line change 9
9
10
10
import py
11
11
import pytest
12
- from _pytest ._code .code import TerminalRepr
12
+ from _pytest ._code .code import FormattedExcinfo , TerminalRepr
13
13
from _pytest .mark import MarkDecorator , MarkerError
14
14
15
15
try :
@@ -1849,12 +1849,12 @@ def toterminal(self, tw):
1849
1849
for tbline in self .tblines :
1850
1850
tw .line (tbline .rstrip ())
1851
1851
lines = self .errorstring .split ("\n " )
1852
- for line in lines :
1853
- if line == lines [ 0 ]:
1854
- prefix = 'E '
1855
- else :
1856
- prefix = ' '
1857
- tw . line ( prefix + line .strip (), red = True )
1852
+ if lines :
1853
+ tw . line ( '{} {}' . format ( FormattedExcinfo . fail_marker ,
1854
+ lines [ 0 ]. strip ()), red = True )
1855
+ for line in lines [ 1 :] :
1856
+ tw . line ( '{} {}' . format ( FormattedExcinfo . flow_marker ,
1857
+ line .strip () ), red = True )
1858
1858
tw .line ()
1859
1859
tw .line ("%s:%d" % (self .filename , self .firstlineno + 1 ))
1860
1860
Original file line number Diff line number Diff line change @@ -395,10 +395,11 @@ def test_lookup_error(unknown):
395
395
""" )
396
396
result = testdir .runpytest ()
397
397
result .stdout .fnmatch_lines ([
398
- "*ERROR*test_lookup_error*" ,
399
- "*def test_lookup_error(unknown):*" ,
400
- "*fixture*unknown*not found*" ,
401
- "*available fixtures*" ,
398
+ "*ERROR at setup of test_lookup_error*" ,
399
+ " def test_lookup_error(unknown):*" ,
400
+ "E fixture 'unknown' not found" ,
401
+ "> available fixtures:*" ,
402
+ "> use 'py*test --fixtures *' for help on them." ,
402
403
"*1 error*" ,
403
404
])
404
405
assert "INTERNAL" not in result .stdout .str ()
You can’t perform that action at this time.
0 commit comments