Skip to content

Commit

Permalink
realpath bug fixed in Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Sep 11, 2023
1 parent 312bcc6 commit 0efbb03
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions tests/test_01_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ def require_islink_dir(self) -> None:
if self.broken_islink_dir:
raise unittest.SkipTest("`os.path.islink` is broken for directories.")

def require_realpath(self) -> None:
"""
Skips the test if `os.path.realpath` does not properly support
symlinks.
"""
if self.broken_realpath:
raise unittest.SkipTest("`os.path.realpath` is broken.")

def require_symlink(self) -> None:
"""
Skips the test if `os.symlink` is not supported.
Expand Down Expand Up @@ -140,31 +132,6 @@ def test_02_link_1_check_1_symlink(self):
finally:
self.__class__.no_symlink = no_symlink

def test_02_link_1_check_2_realpath(self):
"""
Tests whether `os.path.realpath` works properly with symlinks.
"""
# NOTE: Windows does not follow symlinks with `os.path.realpath`
# which is what we use to detect recursion. See <https://bugs.python.org/issue9949>
# for details.
broken_realpath: Optional[bool] = None
try:
self.require_symlink()
file = self.temp_dir / 'file'
link = self.temp_dir / 'link'
mkfile(file)
os.symlink(file, link)

try:
self.assertEqual(os.path.realpath(file), os.path.realpath(link))
except AssertionError:
broken_realpath = True
else:
broken_realpath = False

finally:
self.__class__.broken_realpath = broken_realpath

def test_02_link_1_check_3_islink(self):
"""
Tests whether `os.path.islink` works properly with symlinks to directories.
Expand Down Expand Up @@ -269,7 +236,6 @@ def test_02_link_4_recursive_links(self):
Tests detection of recursive links.
"""
self.require_symlink()
self.require_realpath()
self.require_islink_dir()
self.make_dirs([
'Dir',
Expand All @@ -291,7 +257,6 @@ def test_02_link_5_recursive_circular_links(self):
Tests detection of recursion through circular links.
"""
self.require_symlink()
self.require_realpath()
self.require_islink_dir()
self.make_dirs([
'A',
Expand Down

0 comments on commit 0efbb03

Please sign in to comment.