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

path is stubbed out too aggressively #53

Closed
eakuefner opened this issue Oct 29, 2015 · 1 comment
Closed

path is stubbed out too aggressively #53

eakuefner opened this issue Oct 29, 2015 · 1 comment
Assignees
Labels

Comments

@eakuefner
Copy link

I have code that looks like this:

import os

from mymodule import path

print path.MyAwesomeMethod

When I try to unit test it inside of a fake_filesystem_unittest.TestCase, I get:

    ...
    File ".../pyfakefs/pyfakefs/fake_filesystem.py", line N, in __getattr__
  KeyError: 'MyAwesomeMethod'

However, changing the import in the snippet to from mymodule import path as path_module avoids this, which indicates that pyfakefs is stubbing out any module named path, where if possible it should only stub out os.path.

@jmcgeheeiv jmcgeheeiv self-assigned this Dec 26, 2015
mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Oct 8, 2016
- can be set to False to avoid patching 'path' (see pytest-dev#53)
- added optional argument to TestCase constructor to set it
@jmcgeheeiv
Copy link
Contributor

Fixed by PR #130.

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

No branches or pull requests

3 participants