pytest-dev / pyfakefs

Provides a fake file system that mocks the Python file system modules.
https://pytest-pyfakefs.readthedocs.io
Apache License 2.0
651 stars 91 forks source link

Add some support for loading fake modules #1080

Closed mrbean-bremen closed 1 month ago

mrbean-bremen commented 1 month ago

This will not handle all possible cases. Relative imports are not supported, and for absolute imports in dot notation an __init__.py is expected in module paths above the leaf module.

Tasks

mrbean-bremen commented 1 month ago

@Aran-Fey: I only added two tests (one of them basically your example test), please check if you need more cases covered.

Aran-Fey commented 1 month ago

I'm surprised that relative imports don't work, but that's not a problem for me. This will help a lot, thanks!

mrbean-bremen commented 1 month ago

I'm surprised that relative imports don't work

You are right, this is easy to fix. Will do this.