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

pathlib.Path.readlink not implemented #584

Closed
satwell opened this issue Feb 2, 2021 · 3 comments
Closed

pathlib.Path.readlink not implemented #584

satwell opened this issue Feb 2, 2021 · 3 comments

Comments

@satwell
Copy link

satwell commented Feb 2, 2021

Describe the bug
Python 3.9 added a readlink() method to pathlib.Path. Trying to use this method with pyfakefs raises an AttributeError.

How To Reproduce

from pyfakefs import fake_filesystem, fake_pathlib

fake_fs = fake_filesystem.FakeFilesystem()
fake_pathlib = fake_pathlib.FakePathlibModule(fake_fs)
p = fake_pathlib.Path("/foo/bar")
p.readlink()

This will raise an exception like this:

Traceback (most recent call last):
  File "/tmp/test_readlink.py", line 6, in <module>
    p.readlink()
  File "/usr/lib/python3.9/pathlib.py", line 1281, in readlink
    path = self._accessor.readlink(self)
AttributeError: '_FakeAccessor' object has no attribute 'readlink'

Your environment

Python 3.9.1+ (default, Jan 20 2021, 14:49:22) 
[GCC 10.2.1 20210110]
pyfakefs 4.3.3
@mrbean-bremen
Copy link
Member

Thanks - missed that one!

@mrbean-bremen
Copy link
Member

Should work now in master, please check.

@satwell
Copy link
Author

satwell commented Feb 4, 2021

readlink works for me in master now, thanks!

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

2 participants