Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest.deprecated_call doesn't catch PendingDeprecationWarnings #1037

Closed
alex opened this issue Sep 21, 2015 · 4 comments
Closed

pytest.deprecated_call doesn't catch PendingDeprecationWarnings #1037

alex opened this issue Sep 21, 2015 · 4 comments
Labels
type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed
Milestone

Comments

@alex
Copy link
Contributor

alex commented Sep 21, 2015

In 2.7.3 it did, but now it doesn't.

@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog labels Sep 21, 2015
@RonnyPfannschmidt RonnyPfannschmidt added this to the 2.8.1 milestone Sep 21, 2015
@hpk42
Copy link
Contributor

hpk42 commented Sep 28, 2015

i tried for 5 minutes or so to reproduce the failing test suite but ran into problems. Could you provide an example of what goes wrong, at the least provide a link to a failed test run with 2.8 that worked with 2.7.3?

@alex
Copy link
Contributor Author

alex commented Sep 28, 2015

(tempenv-079b216902410) ~/.v/tempenv-079b216902410 $ pip install pytest==2.7.3
Collecting pytest==2.7.3
  Using cached pytest-2.7.3-py2.py3-none-any.whl
Collecting py>=1.4.29 (from pytest==2.7.3)
  Using cached py-1.4.30-py2.py3-none-any.whl
Installing collected packages: py, pytest
Successfully installed py-1.4.30 pytest-2.7.3
(tempenv-079b216902410) ~/.v/tempenv-079b216902410 $ py.test t.py
====================================================== test session starts =======================================================
platform darwin -- Python 2.7.10 -- py-1.4.30 -- pytest-2.7.3
rootdir: /Users/vacogaynoa/.virtualenvs/tempenv-079b216902410, inifile:
collected 1 items

t.py .

==================================================== 1 passed in 0.00 seconds ====================================================
(tempenv-079b216902410) ~/.v/tempenv-079b216902410 $ pip install -U pytest
Collecting pytest
  Using cached pytest-2.8.0-py2.py3-none-any.whl
Requirement already up-to-date: py>=1.4.29 in ./lib/python2.7/site-packages (from pytest)
Installing collected packages: pytest
  Found existing installation: pytest 2.7.3
    Uninstalling pytest-2.7.3:
      Successfully uninstalled pytest-2.7.3
Successfully installed pytest-2.8.0
(tempenv-079b216902410) ~/.v/tempenv-079b216902410 $ 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/vacogaynoa/.virtualenvs/tempenv-079b216902410, inifile:
collected 1 items

t.py F

============================================================ FAILURES ============================================================
_____________________________________________________________ test_f _____________________________________________________________

    def test_f():
>       pytest.deprecated_call(f)
E       AssertionError: <function f at 0x106ce7410> did not produce DeprecationWarning

t.py:11: AssertionError
------------------------------------------------------ Captured stderr call ------------------------------------------------------
/Users/vacogaynoa/.virtualenvs/tempenv-079b216902410/t.py:7: PendingDeprecationWarning: msg
  warnings.warn('msg', PendingDeprecationWarning)
==================================================== 1 failed in 0.00 seconds ====================================================
(tempenv-079b216902410) ~/.v/tempenv-079b216902410 $ cat t.py
import warnings

import pytest


def f():
    warnings.warn('msg', PendingDeprecationWarning)


def test_f():
    pytest.deprecated_call(f)

@hpk42
Copy link
Contributor

hpk42 commented Sep 28, 2015

thanks. the offending commit seems to be 52b4eb6 -- maybe @hunse can take a look?

@hpk42 hpk42 mentioned this issue Sep 28, 2015
hunse added a commit to hunse/pytest that referenced this issue Sep 28, 2015
`deprecated_call` now looks for PendingDeprecationWarnings,
as it did previously but was broken by pytest-dev#897. Fixes pytest-dev#1037.

Also added a test so this does not happen again.
@hunse
Copy link
Contributor

hunse commented Sep 28, 2015

Okay, I've got a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

4 participants