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

fake_pathlib's resolve() does not reproduce error when path has file ancestor #139

Closed
romanlevin opened this issue Nov 28, 2016 · 7 comments
Assignees
Labels

Comments

@romanlevin
Copy link

Under Python 3.6:

>>> p = pathlib.Path('/path/to/file/this can not exist')
>>> p.resolve()
Traceback (most recent call last):
  ...
NotADirectoryError: [Errno 20] Not a directory: '/path/to/file/this can not exist'

pyfakefs.fake_pathlib.FakePath.resolve() does not raise an exception.

@romanlevin romanlevin changed the title Fake pathlib's resolve() does not reproduce error when path has file ancestor fake_pathlib's resolve() does not reproduce error when path has file ancestor Nov 28, 2016
@mrbean-bremen mrbean-bremen self-assigned this Nov 28, 2016
@mrbean-bremen
Copy link
Member

Thanks for the report - you may be the first user of fake_pathlib so far, so we are certainly happy to get any feedback. I will have a look into this.

mrbean-bremen added a commit that referenced this issue Nov 30, 2016
- raise NotADirectoryError where needed so it raised by os.readlink
- made pathlib resolve() better conform to real implementation
- added strict argument to resolve in Python 3.6
- see #139
- made some fake_pathlib functions available only in 3.5 as in the real implementation
@mrbean-bremen
Copy link
Member

I just added some fixes - please check if this solves your problem.
Note that you have to use the latest Python 3.6 beta (beta 4), as resolve() has got an additional strict argument, and the default behavior has changed (e.g. it does not throw with your example code).

@romanlevin
Copy link
Author

@mrbean-bremen Thanks for pointing out this change in 3.6.0b4. It's not very well documented and would have taken me a while to find otherwise.

@romanlevin
Copy link
Author

Verified that issue is solved on Python 3.6.0b4 with e3449bf.

@mrbean-bremen
Copy link
Member

Well, we have to check again after the final version gets out - there always may be some changes. Though I don't really expect any, as the final version shall be out in another 2 weeks.

@romanlevin
Copy link
Author

Yeah. although I wouldn't have expected this kind of compatibility-breaking change between beta releases, either.

@mrbean-bremen
Copy link
Member

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

2 participants