Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Ankit Goel
1b51497936
[WIP] Update warning stacklevel when wrapping warnings.warn
2018-10-18 02:36:41 +00:00
Anthony Sottile
e0f6fce9e9
In python2, display previously warned warnings
2018-10-10 09:37:21 -07:00
Anthony Sottile
aeb92accb2
Implement pytest.deprecated_call with pytest.warns
2018-10-10 08:03:23 -07:00
Bruno Oliveira
4592def14d
Improve test_rewarn_functional
2018-09-04 17:02:56 -03: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
Jeffrey Rackauckas
a5d9fbe2b0
Change pytest.raises to use match instead of matches
2018-03-27 20:24:15 -07:00
Bruno Oliveira
90a8faabba
Fix test for py37
...
In previous Python versions, the list of warnigns appears like:
... list of emitted warnings is: [UserWarning('user',)].
In Python 3.7 apparently the string representation has been improved to:
... list of emitted warnings is: [UserWarning('user')].
Fix #3011
2018-01-30 20:33:07 -02:00
Anthony Sottile
bd1d17e8de
Replace py.std with stdlib imports
2018-01-09 12:44:10 -08:00
Bruno Oliveira
983a09a2d4
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2017-11-10 18:33:02 -02:00
Bruno Oliveira
03829fde8a
Fix linting E741: ambiguous variable name
2017-11-04 13:59:10 -02:00
Joan Massich
aa6a67044f
Add match_regex functionality to warns
2017-09-07 09:58:03 +02:00
Joan Massich
d8ecca5ebd
Add test to design warns signature in TDD mimicking raises signature
2017-09-04 15:26:00 +02:00
Bruno Oliveira
0726d9a09f
Turn warnings into errors in pytest's own test suite
...
Fix #2588
2017-07-22 21:44:18 -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
7248b759e8
Fixed E303 flake8 errors
...
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Bruno Oliveira
620ba5971f
deprecated_call context manager captures warnings already raised
...
Fix #2469
2017-06-06 22:40:04 -03:00
Bruno Oliveira
1dee443c2b
Merge pull request #2445 from nicoddemus/warnings-remove-filter
...
No longer override existing warning filters during warnings capture
2017-05-30 18:14:01 -03:00
Bruno Oliveira
32e2642233
No longer override existing warning filters during warnings capture
...
Fix #2430
2017-05-30 17:17:36 -03:00
Bruno Oliveira
f96a1d89c5
pytest.deprecated_call now captures PendingDeprecationWarning in context manager form
...
Fix #2441
2017-05-30 12:52:18 -03:00
Bruno Oliveira
9f85584656
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-20 19:59:05 -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
Bruno Oliveira
be5db6fa22
Capture warnings around the entire runtestprotocol
...
This is necessary for the warnings plugin to play nice with the
recwarn fixture
2017-03-16 21:54:41 -03:00
Bruno Oliveira
3c07072bfd
Fix test_recwarn in Python 3.6
...
No longer test for implementation details of recwarn since warnings.catch_warnings has changed
significantly in 3.6.
2017-03-13 19:52:35 -03:00
Bruno Oliveira
22864b75ee
Refactor recwarn to use warnings.catch_warnings instead of custom code
...
Since we dropped 2.5, we can now use warnings.catch_warnings to do the
"catch warnings" magic for us, simplifying the code a bit.
2017-03-13 19:28:36 -03:00
Thomas Kriechbaumer
43662ce789
allow error message matching in pytest.raises
2017-02-02 19:52:33 +01:00
Loïc Estève
7930a8373d
Newline for flake8
2017-01-03 10:57:19 -02:00
Loïc Estève
0bd8159b60
Add a test when multiple classes are specified in warns
2017-01-03 10:57:19 -02:00
Loïc Estève
6fd0394c63
pytest.warns checks for subclass relationship
...
rather than class equality. This makes it more similar to
pytest.raises.
2017-01-03 10:57:19 -02:00
Bruno Oliveira
402fbe503a
Merge branch 'master' into merge-master-into-features
2016-12-27 23:31:26 -02:00
Loïc Estève
c5f0b751f4
Improve error message when pytest.warns fail
...
The error message contains the expected type of warnings and the
warnings that were captured. Add tests.
2016-12-20 13:45:39 +01:00
Ronny Pfannschmidt
e9668d75b8
turn RecordedWarning into a namedtuple
...
fixes #2013
2016-10-24 15:23:53 +02:00
Bruno Oliveira
86b6ce5042
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2015-12-10 19:41:14 -02:00
Bruno Oliveira
1c46462991
Fix deprecated_call regression introduced in 2.8.4
...
Fix #1238
2015-12-08 22:40:05 -02:00
Buck Golemon
5ccb7b1ced
update test_recwarn to new style
2015-12-08 11:08:33 -08:00
Buck Golemon
eabf2f9091
Merge branch 'master' into features
...
Conflicts:
AUTHORS
_pytest/__init__.py
_pytest/hookspec.py
_pytest/recwarn.py
testing/test_recwarn.py
2015-12-07 14:28:59 -08:00
Bruno Oliveira
603d81ef2f
deprecated_call now uses monkey patching strategy to capture warnings
...
similar to what we had in 2.7, with a few enhancements
Fix #1190
2015-11-26 16:48:58 -02:00
holger krekel
cb58eaa611
Merge remote-tracking branch 'upstream/master' into features
...
Conflicts:
_pytest/__init__.py
testing/test_recwarn.py
2015-09-29 15:56:41 +02:00
Eric Hunsberger
4194c9cce2
Check `deprecated_call` specific to deprecation
...
`deprecated_call` used to accept any warning. As of #897 , it
is now specific to DeprecationWarnings, and another commit in
this PR extends this to PendingDeprecationWarnings. This commit
makes sure this stays the case.
2015-09-28 12:35:24 -04:00
Eric Hunsberger
e8261e0c77
`deprecated_call` detects pending warnings again
...
`deprecated_call` now looks for PendingDeprecationWarnings,
as it did previously but was broken by #897 . Fixes #1037 .
Also added a test so this does not happen again.
2015-09-28 12:11:52 -04:00
Galaczi Endre
beaa8e55bd
Fixes #653 use deprecated_call as context_manager
2015-09-21 19:01:23 +01:00
Bruno Oliveira
2bbe709bce
Use testdir fixture in test_double_test to ensure controlled environment for execution
...
Because the test relies that two subsequent tests try to use pytest.warns to capture
the exact same warning, it is better to use testdir to ensure test execution
occurs in the order we expect (which might be different with pytest-xdist or
pytest-random for example)
2015-08-06 22:30:01 -03:00
Eric Hunsberger
39f1471e93
Warnings always raised in WarningsRecorder
...
This ensures that if tests for warnings are run more than once,
the warning is still raised as expected.
2015-08-06 15:05:01 -04:00
Bruno Oliveira
02e742b7a6
Move WarningsChecker import in test to a local import to workaround flakes issue
...
See #897 for discussion
2015-08-04 19:27:13 -03: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
Anatoly Bubenkov
6af7172204
Merge branch 'pytest-2.7'
2015-07-19 15:25:04 +02:00
Bruno Oliveira
9fb1637ce2
Test that deprecated_call keeps internal warnings structures intact
2015-06-26 00:26:59 -03:00
Pieter Mulder
444cdfe6e3
Correct test_deprecated_call_preserves test.
...
Test if we preserve the correct functions.
2015-06-25 17:33:40 +02:00
holger krekel
894d7dca22
avoid undocumented special casing of "pytest_" prefix
...
--HG--
branch : plugin_no_pytest
2015-04-22 13:44:37 +02:00