Commit Graph

81 Commits

Author SHA1 Message Date
Bruno Oliveira 9ae8429a21 Use a more specific exception type in test_raises_repr_inflight
As requested during review
2018-11-22 20:24:46 -02:00
Ronny Pfannschmidt b71bd9b300 fix #4386 - handle uninitialized exceptioninfo in repr/str 2018-11-22 20:52:15 +01:00
Anthony Sottile b3700f61ba Fix formatting of print() calls 2018-11-22 00:15:14 -08:00
Daniel Hahler e30f7094f3 python: collect: ignore exceptions with isinstance
Fixes https://github.com/pytest-dev/pytest/issues/4266.
2018-11-01 22:14:13 +01:00
Anthony Sottile 2368fbb63c Apply reorder-python-imports to all files 2018-10-25 00:01:29 -07:00
Anthony Sottile 4ae93a7a07 Remove obsolete __future__ imports 2018-07-08 08:37:02 -07:00
Anthony Sottile cbaa7dd56a Upgrade pre-commit hooks except pyupgrade 2018-06-26 06:35:27 -07:00
Ronny Pfannschmidt 703e4b11ba run black 2018-05-23 16:48:46 +02:00
Ronny Pfannschmidt 9aacb4635e run pyupgrade 2018-05-23 16:45:09 +02:00
Tim Strazny ec2d8223cf Fix issue #3372 2018-04-06 14:16:12 +02:00
Jeffrey Rackauckas 34afded06d Update pytest.raises to raise a TypeError when an invalid keyword argument is passed. 2018-03-27 19:57:15 -07:00
Florian Bruhin 3cbf0c8ec0 Raise unexpected exceptions with pytest.raises() using match= 2018-02-15 12:11:56 +01:00
Andras Tim 7248b759e8 Fixed E303 flake8 errors
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Michal Wajszczuk fb0b90646e New-style classes implemented for python 2.7 - #2147 2017-02-16 20:28:17 +01:00
Bruno Oliveira abbff681ba Fix '{0}' format for py26 2017-02-02 18:01:44 -02:00
Thomas Kriechbaumer 43662ce789 allow error message matching in pytest.raises 2017-02-02 19:52:33 +01:00
Bruno Oliveira efc54b2e56 Merge branch 'master' into merge-master-features 2016-11-11 18:56:53 -02:00
Bruno Oliveira 1130b9f742 Fix the stubborn test about cyclic references left by pytest.raises
In Python 2, a context manager's __exit__() leaves sys.exc_info with the exception values even when it was supposed
to suppress the exception, so we explicitly call sys.exc_clear() which removes the traceback and allow the object
to be released.

Also updated the test to not depend on the immediate destruction of the object but instead to ensure it is not being
tracked as a cyclic reference.

Fix #1965
2016-11-08 22:20:27 -02:00
Michael Seifert 552c7d4286 added test (thanks @nicoddemus) and added links in Changelog 2016-11-08 22:13:02 -02:00
Floris Bruynooghe 28b1896e9a Remove BuiltinAssertionError
We used to have this when we where patching the real Python
AssertionError for use with reinterpret, but reinterpret is now
gone so we no longer need this as it is not used by rewrite.
2016-09-05 15:29:09 +02:00
Florian Bruhin 54872e94b4 Fix test name typo 2016-06-20 18:44:34 +02:00
palaviv ca093673fb pytest.raises accept cutom message only when used as context manager 2016-06-19 21:24:47 +03:00
palaviv e6ff01ada3 CR fixes 2016-06-16 21:09:15 +03:00
palaviv d21886c005 pytest.raises accpets custom message 2016-06-16 20:15:32 +03:00
Georgy Dyuldin 79722ae89b Add expected exceptions to 'DID NOT RAISE' msg 2016-02-03 14:12:41 +03:00
Bruno Oliveira a912d3745b Moved py.code code over to py.test
Fix #103
2016-01-25 23:18:04 -02:00
Eric Hunsberger 52b4eb6c46 Added `warns` to assert warnings are thrown
Works in a similar manner to `raises`, but for warnings instead
of exceptions. Also refactored `recwarn.py` so that all the
warning recording and checking use the same core code.
2015-07-30 23:28:32 -04:00
Bruno Oliveira eb73db56c7 Fix issue where pytest.raises() doesn't always return Exception instance in py26
Fixes #767
2015-06-19 07:46:47 -03:00
Floris Bruynooghe faba432996 Improve error message if pytest.raises is used wrongly
If the type is not checked then an incomprehensible error will occur
later.  This enforces the type and raies the same exception/msg as
CPython does in that case.

Docstring unmodified, just re-justified for pep8 compat.
2014-04-14 18:09:10 -04:00
holger krekel 8ac5af2896 fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
holger krekel ba9b27fcd3 fix issue215 - refactor test_python.py into multiple files:
- python/collect.py cotaining the core collection nodes
- python/fixture.py containing funcargs/fixture code
- python/metafunc.py generate_tests and metafunc usage
- python/raises.py the pytest.raises implementation
2012-11-02 16:04:57 +01:00