How can I use pytest
within an embedded Python environment with __debug__ == False
?
#12460
-
I'm trying to use What options do I have here? I suppose I could manually raise |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
As I've been looking into this, I'm confused why |
Beta Was this translation helpful? Give feedback.
It looks like
sys.path_hooks[1]
returns instances of an oldFileFinder
class that is not reachable atimportlib.machinery.FileFinder
. The spec objects returned by itsfind_spec
method also refer to an old version ofSourceFileLoader
. That's what causes theisinstance
check to fail.The simplest solution I've found is to extract a reference to the old class and replace the new class, i.e.
As best I can tell, this doesn't cause any side effects.
This has been a strange adventure, but I think it ends here.