Skip to content

Commit

Permalink
islink works with pypy on windows in my testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Sep 12, 2023
1 parent 0efbb03 commit 64ea07e
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions tests/test_01_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ def make_links(self, links: Iterable[Tuple[str, str]]) -> None:
"""
make_links(self.temp_dir, links)

def require_islink_dir(self) -> None:
"""
Skips the test if `os.path.islink` does not properly support symlinks to
directories.
"""
if self.broken_islink_dir:
raise unittest.SkipTest("`os.path.islink` is broken for directories.")

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

def test_02_link_1_check_3_islink(self):
"""
Tests whether `os.path.islink` works properly with symlinks to directories.
"""
# NOTE: PyPy on Windows does not detect symlinks to directories.
# - See <https://foss.heptapod.net/pypy/pypy/-/issues/3434>
broken_islink_dir: Optional[bool] = None
try:
self.require_symlink()
folder = self.temp_dir / 'folder'
link = self.temp_dir / 'link'
os.mkdir(folder)
os.symlink(folder, link)

try:
self.assertTrue(os.path.islink(link))
except AssertionError:
broken_islink_dir = True
else:
broken_islink_dir = False

finally:
self.__class__.broken_islink_dir = broken_islink_dir

def test_02_link_2_links(self):
"""
Tests to make sure links to directories and files work.
"""
self.require_symlink()
self.require_islink_dir()
self.make_dirs([
'Dir',
])
Expand Down Expand Up @@ -200,7 +167,6 @@ def test_02_link_3_sideways_links(self):
times via links.
"""
self.require_symlink()
self.require_islink_dir()
self.make_dirs([
'Dir',
'Dir/Target',
Expand Down Expand Up @@ -236,7 +202,6 @@ def test_02_link_4_recursive_links(self):
Tests detection of recursive links.
"""
self.require_symlink()
self.require_islink_dir()
self.make_dirs([
'Dir',
])
Expand All @@ -257,7 +222,6 @@ def test_02_link_5_recursive_circular_links(self):
Tests detection of recursion through circular links.
"""
self.require_symlink()
self.require_islink_dir()
self.make_dirs([
'A',
'B',
Expand Down Expand Up @@ -315,7 +279,6 @@ def test_02_link_8_no_follow_links(self):
Tests to make sure directory links can be ignored.
"""
self.require_symlink()
self.require_islink_dir()
self.make_dirs([
'Dir',
])
Expand Down

0 comments on commit 64ea07e

Please sign in to comment.