Skip to content

pathlib.Path.readlink not implemented #584

@satwell

Description

@satwell

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions