Jordan Moldow
2e61f702c0
Support PEP-415's Exception.__suppress_context__
...
PEP-415 states that `exception.__context__` should be suppressed
in traceback outputs, if `exception.__suppress_context__` is
`True`.
Now if a ``raise exception from None`` is caught by pytest,
pytest will no longer chain the context in the test report.
The algorithm in `FormattedExcinfo` now better matches the one
in `traceback.TracebackException`.
`Exception.__suppress_context__` is available in all of the
versions of Python 3 that are supported by pytest.
Fixes #2631 .
2017-07-29 02:39:17 -07:00
Bruno Oliveira
7b1870a94e
Fix flake8 in features branch
2017-07-17 21:16:14 -03:00
Andras Tim
85141a419f
Fixed E701 flake8 errors
...
multiple statements on one line (colon)
2017-07-17 01:44:23 +02:00
Andras Tim
b9e318866e
Fixed E402 flake8 errors
...
module level import not at top of file
2017-07-17 01:44:23 +02:00
Andras Tim
7248b759e8
Fixed E303 flake8 errors
...
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Andras Tim
b840622819
Fixed E302 flake8 errors
...
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
17a21d540b
Fixed E301 flake8 errors
...
expected 1 blank line, found 0
2017-07-17 01:44:23 +02:00
Andras Tim
195a816522
Fixed E265 flake8 errors
...
block comment should start with ‘# ‘
2017-07-17 01:44:22 +02:00
Andras Tim
8f3eb6dfc7
Fixed E261 flake8 errors
...
at least two spaces before inline comment
2017-07-17 01:44:22 +02:00
Andras Tim
617e510b6e
Fixed E231 flake8 errors
...
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Andras Tim
4b22f270a3
Fixed E226 flake8 errors
...
missing whitespace around arithmetic operator
2017-07-17 01:44:22 +02:00
Andras Tim
f640e0cb04
Fixed E221 flake8 errors
...
multiple spaces before operator
2017-07-17 01:44:22 +02:00
Andras Tim
ba0a4d0b2e
Fixed E202 flake8 errors
...
whitespace before ‘)’
2017-07-17 01:28:17 +02:00
Andras Tim
df54bf0db5
Fixed E131 flake8 errors
...
continuation line unaligned for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim
cf97159009
Fixed E128 flake8 errors
...
continuation line under-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim
57438f3efe
Fixed E127 flake8 errors
...
continuation line over-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim
051d76a63f
Fixed E124 flake8 errors
...
closing bracket does not match visual indentation
2017-07-17 01:28:16 +02:00
Bruno Oliveira
8bb589fc5d
Fix internal error when trying to detect the start of a recursive traceback.
...
Fix #2486
2017-06-09 19:26:26 -03:00
Bruno Oliveira
2127a2378a
Fix internal error with recursive tracebacks with that frames contain objects that can't be compared
...
Fix #2459
2017-06-07 14:40:13 -03:00
Bruno Oliveira
4d947077bb
Fix test in py26 that expected a floor division error message
2017-03-16 23:07:03 -03:00
Bruno Oliveira
42a5d6bdfa
Add __future__ imports to all pytest modules
...
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Michal Wajszczuk
fb0b90646e
New-style classes implemented for python 2.7 - #2147
2017-02-16 20:28:17 +01:00
Bruno Oliveira
984d4ce5ec
Fix test_excinfo_getstatement that broke because of whitespace changes
2016-11-20 19:12:42 -02:00
Bruno Oliveira
1eb5a690d4
Fix flake8 E305 and E306 errors
...
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Bruno Oliveira
006a901b86
Properly handle exceptions in multiprocessing tasks
...
Fix #1984
2016-11-03 10:48:43 -02:00
Bruno Oliveira
31c5194562
Fix broken test in py3k
2016-08-01 18:35:42 -03:00
satoru
3c8222f1db
Highlight the path of file location in error report
...
So that it's more obvious when we need to copy the file path.
2016-08-01 17:42:20 -03:00
Floris Bruynooghe
d1852a48b7
Remove assertion reinterpretation
...
The assertion reinterpretation is an old backwards compatibility
mode which was no longer being maintained on feature-parity with
the assertion rewriting mode. It was also responsible for some
dubious patching of builtins and test with side-effects would
suddenly start passing. Since re-writing has been the default for
a long time and plugins are now also re-written it is time to
retire reinterpretation.
2016-07-15 00:33:39 +01:00
Bruno Oliveira
458ecae1df
Replace all usages of "pytest_funcarg__" for @pytest.fixture
2016-07-11 22:21:52 -03:00
Ronny Pfannschmidt
b9a91dc112
merge from master to features
2016-07-06 11:51:48 +02:00
Tom Viner
df9918eda3
issue1625, name getfuncargvalue to getfixturevalue
2016-06-24 10:08:19 +02:00
Ronny Pfannschmidt
083f64100d
merge master into features
2016-06-22 14:39:33 +02:00
marscher
09d163aa3a
[exception handling] Fix case the current working directory (CWD) gets deleted during testing.
...
Fixes #1235 .
2016-06-08 15:18:23 +02:00
Ronny Pfannschmidt
c49863aa63
merge next chunk from master and fix changelog linting issue
2016-05-13 19:36:47 +02:00
Florian Bruhin
75160547f2
Use a callable __tracebackhide__ for filtering
...
While this leads to slightly more complicated user code for the common
case (checking if the exception is of a given type) it's easier to
implement and more flexible.
2016-04-20 11:09:27 +02:00
Florian Bruhin
4c552d4ef7
Fix tests for python 2.6
2016-04-20 10:36:13 +02:00
Florian Bruhin
b607f6728f
Filter selectively with __tracebackhide__
...
When __tracebackhide__ gets set to an exception type or list/tuple of
exception types, only those exceptions get filtered, while the full
traceback is shown if another exception (e.g. a bug in a assertion
helper) happens.
2016-04-20 10:25:33 +02:00
Martin Prusse
7ce5873da2
Perform a "unicode aware" check for maximum recursion depth error
...
Avoid errors `UnicodeErrosr`s due non maximum recursion depth errors
when checking for those errors.
2016-04-08 23:32:18 -03:00
Ronny Pfannschmidt
0f7aeafe7c
Merge pull request #1486 from roolebo/fix-issue-138
...
Fix issue #138 - support chained exceptions
2016-04-03 19:21:57 +02:00
Omar Kohl
c578226d43
Implement ExceptionInfo.match() to match regexp on str(exception)
...
This implements similar functionality to
unittest.TestCase.assertRegexpMatches()
closes #372
2016-04-03 11:22:44 +02:00
Roman Bolshakov
fbc5ba08d9
Fix issue #138
2016-03-20 01:02:17 +03:00
Bruno Oliveira
a912d3745b
Moved py.code code over to py.test
...
Fix #103
2016-01-25 23:18:04 -02:00
holger krekel
d1aff902d5
remove pylib things and move things to new pytest namespace
...
--HG--
branch : trunk
2010-10-07 11:59:00 +02:00
holger krekel
6f40441ef8
fixing test for python2.4 (thanks ronny)
...
--HG--
branch : trunk
2010-09-08 18:29:26 +02:00
Ronny Pfannschmidt
2b59200786
implement and naively test the native traceback style
...
--HG--
branch : trunk
2010-09-08 12:00:36 +02:00
holger krekel
677f7c0a6a
remove trailing whitespace everywhere
...
--HG--
branch : trunk
2010-07-26 21:15:15 +02:00
holger krekel
29a5b7452e
* improve and test --tb=short reporting
...
* show --tb=short tracebacks for importing test modules
--HG--
branch : trunk
2010-05-22 16:18:24 +02:00
holger krekel
379390a8aa
remove code.new() function and store lines directly into linecache.cache instead.
...
This avoids the need for custom code objects, improving compatibility for jython
and pypy-c.
--HG--
branch : trunk
2010-05-11 22:54:04 +02:00
holger krekel
221ac3e466
a couple of more mostly jython-related fixes
...
--HG--
branch : trunk
2010-04-23 13:29:28 +02:00
holger krekel
55fcc5a219
always directly use basename for tracebacks, independently from code.path
...
fixes issue77 although i guess it was already fixed before.
--HG--
branch : trunk
2010-01-18 12:12:18 +01:00