Skip to content

pytest triggering deprecation warnings in 3.0.5 #2118

Closed

Description

@nicoddemus

As commented by @nedbat in https://bitbucket.org/ned/coveragepy/pull-requests/94, it seems pytest itself is making use of the deprecated compatproperty names:

/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.Class instead
  obj = getattr(holderobj, name, None)
/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.File instead
  obj = getattr(holderobj, name, None)
/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.Function instead
  obj = getattr(holderobj, name, None)
/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.Instance instead
  obj = getattr(holderobj, name, None)
/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.Item instead
  obj = getattr(holderobj, name, None)
/Users/ned/coverage/trunk/.tox/py27/lib/python2.7/site-packages/_pytest/fixtures.py:1071: PendingDeprecationWarning: This usage is deprecated, please use pytest.Module instead
  obj = getattr(holderobj, name, None)

cc @nmundar

Activity

  1. added
    type: bugproblem that needs to be addressed
    good first issueeasy issue that is friendly to new contributor
    on Dec 5, 2016
  2. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    this may prove tricky, it happens in parse_factories

  3. nedbat commented on Dec 5, 2016

    @nedbat
    Contributor
  4. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    i'd rather investigate why we run into those objects, and whether we can avoid the situation to begin with (as we could be hiding other deprecations as well)

  5. nedbat commented on Dec 5, 2016

    @nedbat
    Contributor

    A quick test in my tox virtualenv seems to show that the context manager doesn't prevent the warnings..?

    BTW, I run my test suite with:

    # We want to see all warnings while we are running tests.  But we also need to
    # disable warnings for some of the more complex setting up of tests.
    warnings.simplefilter("default")
    
    # Silence specific warnings that are not our fault.
    warnings.filterwarnings("ignore", module="xdist", message="type argument to addoption")
    

    So I try to see warnings, but that last line is to suppress a warning that pytest-xdist causes.

  6. nedbat commented on Dec 5, 2016

    @nedbat
    Contributor

    Oops, I hadn't tried catch_warnings correctly. This works, and should only silence this specific warning:

    with warnings.catch_warnings():
        warnings.filterwarnings("ignore", message="This usage is deprecated, please use pytest.* instead")
        obj = getattr(holderobj, name, None)
    
  7. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    @nedbat if i recall correctly that operation will reset the once filter cache of the warnings module in various python version

  8. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    @nedbat the real bug is, that it tries to operate on a Node object as test object

  9. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    @nicoddemus @nedbat the problem lies in _pytest/python.py:360 - getcustomclass triggers this

    i will fix this one

  10. The-Compiler commented on Dec 5, 2016

    @The-Compiler
    Member

    I can confirm this, breaks my testsuite since I use -Werror 😉

    Bisected to b38fad4 - cc @nmundar

  11. added a commit that references this issue on Dec 5, 2016
  12. nicoddemus commented on Dec 5, 2016

    @nicoddemus
    MemberAuthor

    After @RonnyPfannschmidt fixes it, should we do a 3.0.6 release or it can wait a few weeks?

  13. RonnyPfannschmidt commented on Dec 5, 2016

    @RonnyPfannschmidt
    Member

    @The-Compiler you should never error on pending ones tho ^^

  14. 2 remaining items

  15. RonnyPfannschmidt commented on Dec 6, 2016

    @RonnyPfannschmidt
    Member

    @The-Compiler pendingdeprecations are really silent by default

    also while investigating we added pending deprecation in a really bad way
    i put a real deprecation there because it should fail hard on this one since a while (namely 2.x)

  16. The-Compiler commented on Dec 6, 2016

    @The-Compiler
    Member

    DeprecationWarnings are also silent by default 😉

    Your PR still does PendingDeprecationWarning though, right? FWIW I don't think we should change that to a DeprecationWarning with a patch release.

  17. RonnyPfannschmidt commented on Dec 6, 2016

    @RonnyPfannschmidt
    Member

    i still do the pending ones for the old usage site, i changed the other usage side that uses a old api to log the deprecation

  18. rgant commented on Dec 20, 2016

    @rgant

    Wish I'd known about this error before I upgraded pytest to 3.0.5. I don't think that 3.0.5 should be available without this issue resolved. I guess I'm going to figure out how to downgrade my pytest install.

  19. added a commit that references this issue on Dec 24, 2016
  20. The-Compiler commented on Jan 20, 2017

    @The-Compiler
    Member

    I haven't really had time for much pytest work recently, and just happened to rediscover today that I blacklisted pytest 3.0.5 for qutebrowser 😆

    Judging from the commits referencing this issue, others did the same - so I think this should really be fixed for a 3.0.6.

  21. RonnyPfannschmidt commented on Jan 20, 2017

    @RonnyPfannschmidt
    Member

    i have a related pr in the work, it will be fixed by 3.0.6

  22. The-Compiler commented on Jan 20, 2017

    @The-Compiler
    Member

    I agree with @nicoddemus (this comment and the following ones) that we should rather revert patch-level deprecations and deprecate things properly for the next feature release.

  23. RonnyPfannschmidt commented on Jan 20, 2017

    @RonnyPfannschmidt
    Member

    @The-Compiler the triggering deprecation will be removed, there is an original deprecation that simply doesnt cause warnings that i want to ressurrect at the same time

  24. nicoddemus commented on Jan 20, 2017

    @nicoddemus
    MemberAuthor

    IMHO just moving the deprecation that was introduced to the features branch is enough, no need to ressurect the other deprecation because I suspect users don't see it anyway.

  25. RonnyPfannschmidt commented on Jan 20, 2017

    @RonnyPfannschmidt
    Member

    @nicoddemus both need to be resurrected as they trigger in different usage cases (one happens if attributes on the class dont match the compat property, one triggers when using a compat property in a class declaration)

  26. RonnyPfannschmidt commented on Jan 20, 2017

    @RonnyPfannschmidt
    Member

    @nicoddemus oh, and im reasonably sure both will happen in the pypy codebase

  27. nicoddemus commented on Jan 20, 2017

    @nicoddemus
    MemberAuthor

    Oh OK, thanks.

    I guess after this is in place we can make a 3.0.6 release.

  28. added a commit that references this issue on Jan 20, 2017
    15a3b57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions