~cjwatson/storm/py3-mocker-inspect

Viewing all changes in revision 512.

  • Committer: Colin Watson
  • Date: 2019-08-11 17:17:32 UTC
  • Revision ID: cjwatson@canonical.com-20190811171732-ar8ffgd7bw1ynq5z
Add Python 3 support to tests.mocker.SpecChecker.

inspect.getargspec is deprecated on Python 3, and in any case causes us
problems because it includes the bound first argument (self or similar) for
bound methods.  The modern inspect.signature API is for the most part much
easier to use and doesn't have this problem.

There is one wrinkle which requires special handling: method descriptors
don't have the first argument already bound as far as their signature is
concerned, but for the purposes of a mock spec we want to skip it anyway.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: