Use __future__.absolute_import for spies function.
Review Request #8720 — Created Feb. 6, 2017 and submitted — Latest diff uploaded
I was encountering a bizarre problem where running a unit test that included a
spy was failing withImportError: cannot import name currentframe
. After
doing some digging, I found out that theinspect
module that was being
imported was actuallydjango.utils.inspect
rather than the top-level
standard libraryinspect
. Addingabsolute_import
fixes this.
Was able to run my unit test successfully.