Issue
In my code, I test if config_location
is an instance of PosixPath
or None
:
if isinstance(self.config_location, (PosixPath, type(None))):
...
This works fine when run with the normal python interpreter, but fails during my pytest tests using pyfakefs, as the pyfakefs object is of type pyfakefs.fake_pathlib.FakePathlibModule.PosixPath
. The obvious solution here would be to import pyfakefs into the tested code and add pyfakefs.fake_pathlib.FakePathlibModule.PosixPath
to the isinstance tuple, but this approach seems very clunky to me.
There has to be a better way ?
Solution
Testing for PurePath
instead works.
Answered By - Microkernel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.