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

Add support for glob.iglob #59

Closed
lobobabysaurus opened this issue Dec 30, 2015 · 7 comments · Fixed by #124
Closed

Add support for glob.iglob #59

lobobabysaurus opened this issue Dec 30, 2015 · 7 comments · Fixed by #124
Assignees

Comments

@lobobabysaurus
Copy link

The glob package in python supports glob and iglob methods. The former creates the file name array immediately, while iglob creates an iterator and lazy evaluates the sequence.

The latter is not yet supported by this library

@timofurrer
Copy link

+1

1 similar comment
@daidoji
Copy link

daidoji commented Jun 21, 2016

+1

@mrbean-bremen
Copy link
Member

I just checked this, and I actually don't understand why glob is faked out at all.
As far as I can see, it is implemented using os, and will work correctly with fake_filesystem if faking os. If removing it from the faked modules and the skip names in fake_filesystem_unitest, it seems to work as expected (both glob.glob and glob.iglob).
@jmcgeheeiv: What did I miss?

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Jul 26, 2016
- glob/iglob shall work out of the box if faking os/os.path
- shall fix pytest-dev#59 and pytest-dev#116
@jmcgeheeiv
Copy link
Contributor

@mrbean-bremen, you don't miss much, but could it be that the mock.patch() usage model requires fake glob.glob?

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Sep 12, 2016

@jmcgeheeiv: Sorry, I don't really understand that - could you elaborate on this? Why would it require this?
I removed glob in my own fork and it seemed to work ok, at least in the context of fake_filesystem_unittest, though I only tested the functionality that had been in fake_filesystem_glob_test.

@mrbean-bremen
Copy link
Member

@jmcgeheeiv: Ok, my bad - I didn't understand you mentioning the mock.patch usage model. In that model (which I didn't use, as I find the unit test usage model quite convenient), this may indeed be needed.
OTOH, it is certainly not needed in the unit test context and can savely be removed from the faked modules in the patcher, which will fix these problems at least for that usage. What do you think?

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Oct 2, 2016
- use sources from Python 3.5, slightly adapted to work under Python 2
and use fake file system
- fixes pytest-dev#59 and pytest-dev#116
@mrbean-bremen mrbean-bremen self-assigned this Oct 2, 2016
@jmcgeheeiv
Copy link
Contributor

@mrbean-bremen, I agree that removing glob/iglob from skipped names in fake_filesystem_unittest would not affect the mock.patch() usage model. The mock.patch() usage model does not even use that code.

Since you have triaged this issue with such flair and élan, could I ask you to remove glob/iglob from skipped names, in the manner you believe most appropriate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants