Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to patch modules imported with another name #231

Closed
mrbean-bremen opened this issue Jun 21, 2017 · 0 comments
Closed

Allow to patch modules imported with another name #231

mrbean-bremen opened this issue Jun 21, 2017 · 0 comments

Comments

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jun 21, 2017

This is related to #191.
tempfile imports os as _os and io as _io. With the current mechanism, these will not be patched by Patcher.
For this and other cases with custom modules it makes sense to have a possibility to add these to the patched names, for example by providing an additional dict to Patcher (and TestCase) that holds these names (e,g, something like {'tempfile': {'os': '_os', 'io': '_io'}}).
This could be pre-configured for tempfile, but have the possibility to add other modules.

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Jun 25, 2017
- added argument that allows adding modules for patching that import file system modules under another name
- fixes pytest-dev#231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant