Skip to content

Commit 887d6b0

Browse files
committed
Implement stub functions for os.path.isjunction()
1 parent d0cfd0e commit 887d6b0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pyfakefs/fake_filesystem.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,11 @@ def path(self) -> AnyStr:
576576
dir_path = sep.join(names)
577577
return self.filesystem.absnormpath(dir_path)
578578

579+
@property
580+
def is_junction(self) -> bool:
581+
# TODO: implement junctions
582+
return False
583+
579584
def __getattr__(self, item: str) -> Any:
580585
"""Forward some properties to stat_result."""
581586
if item in self.stat_types:
@@ -3440,6 +3445,22 @@ def islink(self, path: AnyPath) -> bool:
34403445
"""
34413446
return self._is_of_type(path, S_IFLNK, follow_symlinks=False)
34423447

3448+
def isjunction(self, path: AnyPath) -> bool:
3449+
"""Determine if path identifies a junction.
3450+
3451+
Args:
3452+
path: Path to filesystem object.
3453+
3454+
Returns:
3455+
`False` on posix systems.
3456+
`True` if path is a junction on Windows.
3457+
3458+
Raises:
3459+
TypeError: if path is None.
3460+
"""
3461+
# TODO: implement junction on Windows
3462+
return False
3463+
34433464
def confirmdir(
34443465
self, target_directory: AnyStr, check_owner: bool = False
34453466
) -> FakeDirectory:
@@ -3602,6 +3623,7 @@ def dir() -> List[str]:
36023623
"isdir",
36033624
"isfile",
36043625
"islink",
3626+
"isjunction",
36053627
"ismount",
36063628
"join",
36073629
"lexists",
@@ -3702,6 +3724,20 @@ def islink(self, path: AnyStr) -> bool:
37023724
"""
37033725
return self.filesystem.islink(path)
37043726

3727+
def isjunction(self, path: AnyStr) -> bool:
3728+
"""Determine whether path is a junction.
3729+
3730+
Args:
3731+
path: Path to filesystem object.
3732+
3733+
Returns:
3734+
`True` if path is a junction.
3735+
3736+
Raises:
3737+
TypeError: if path is None.
3738+
"""
3739+
return self.filesystem.isjunction(path)
3740+
37053741
def getmtime(self, path: AnyStr) -> float:
37063742
"""Returns the modification time of the fake file.
37073743

0 commit comments

Comments
 (0)