1

I have a set of Python 3 unittests, which, when executed with this command line:

python3 -m unittest discover -f -v

...are generating a PendingDeprecationWarning:

/usr/local/Cellar/python3/3.4.2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py:32:
    PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Is there an easy way for me to trace which peice of code is ultimately using imp.py, perhaps by turning on some form of stack tracing? I have narrowed it down somewhat; it seems to only be triggered when I use freezegun. However, freezegun itself doesn't seem to use imp.

Andrew Ferrier
  • 16,664
  • 13
  • 47
  • 76

1 Answers1

4

When invoking python on the command line, pass the option -Werror to it. This will turn all warnings into errors, and when the warning/error doesn't get handled, it will display a traceback that will give you line numbers and source files for each step that let to the warning/error.

randomusername
  • 7,927
  • 23
  • 50