question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for pathlib.Path.link_to()

See original GitHub issue

Python 3.8 has added a new method to pathlib library: Path.link_to() for creating hard links (https://docs.python.org/3/library/pathlib.html#pathlib.Path.link_to). I think that it is not supported by pyfakefs yet (v. 4.3.3).

It would be nice to mock this method since it is an easy way to create hard links.

Maybe it would be a good idea to include a FakeFilesystem.create_link() method for creating hard links (similar to FakeFilesystem.create_symlink() for soft links).

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrbean-bremencommented, Jan 2, 2021

Ok, I had thought pathlib2 is not used anymore (it is definitely not needed in Python 3.8). Making a separate accessor for pathlib2 is probably not worth it. I could just remove the check for pathlib2 and let it fail if you use pathlib2 instead of pathlib.
This is probably the best option, because if you want to use link_to, you cannot use pathlib2, or you would get the same exception.

1reaction
JD-Veigacommented, Dec 31, 2020

Excellent and quick work! I have installed it from master. Thanks a lot. Happy new year!

Read more comments on GitHub >

github_iconTop Results From Across the Web

pathlib — Object-oriented filesystem paths — Python 3.11.1 ...
New in version 3.4. This module offers classes representing filesystem paths with semantics appropriate for different operating systems.
Read more >
Getting the target of a symbolic link with pathlib - Stack Overflow
Path.relative_to() as name says, transforms existing Path to relative one, without checking whether symbolic link destination path starts with ...
Read more >
Add support for pathlib.Path type #97 - omry/omegaconf - GitHub
Once stronger typing is implemented in the library, consider adding support for the pathlib.Path type. Motivation: paths are often found in ...
Read more >
Python Path – How to Use the Pathlib Module with Examples
Before we jump into this, Pathlib divides the filesystem paths into two different classes that represent two types of path objects: Pure Path...
Read more >
Python 3's pathlib Module: Taming the File System
In this tutorial, you will see how to work with file paths—names of directories and files—in Python. You will learn new ways to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found