-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
pytest.warn doesn't appear to be working for deprecation warnings #1026
Copy link
Copy link
Closed
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarification
Milestone
Description
I'm not sure what to make of this, but it appears to be failing on a very simple test:
(tempenv-6cb925871591c) ~/.v/tempenv-6cb925871591c $ cat t.py
import warnings
import pytest
def test_foo():
with pytest.warns(PendingDeprecationWarning):
warnings.warn("msg", PendingDeprecationWarning)
(tempenv-6cb925871591c) ~/.v/tempenv-6cb925871591c $ py.test t.py
====================================================== test session starts =======================================================
platform darwin -- Python 2.7.10, pytest-2.8.0, py-1.4.30, pluggy-0.3.1
rootdir: /Users/alex_gaynor/.virtualenvs/tempenv-6cb925871591c, inifile:
collected 1 items
t.py F
============================================================ FAILURES ============================================================
____________________________________________________________ test_foo ____________________________________________________________
def test_foo():
with pytest.warns(PendingDeprecationWarning):
> warnings.warn("msg", PendingDeprecationWarning)
E Failed: DID NOT WARN
t.py:8: Failed
==================================================== 1 failed in 0.01 seconds ====================================================
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarification