Skip to content

Commit

Permalink
Sharpen asserts in an attempt to debug failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Oct 20, 2024
1 parent 94d1f5e commit 2806efe
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_fs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import tempfile

from hatchling.utils.fs import locate_file


def test_locate_file_with_symlinks():
with tempfile.TemporaryDirectory() as temp_dir:
# Create a directory structure with a cycle
os.makedirs(os.path.join(temp_dir, 'a', 'b', 'c'))
os.symlink(temp_dir, os.path.join(temp_dir, 'a', 'b', 'c', 'link_to_root'))

# Create test file
with open(os.path.join(temp_dir, 'target_file.txt'), 'w') as f:
f.write('target')

# Test cases
# assert locate_file(os.path.join(temp_dir, 'a', 'b', 'c', 'link_to_root', 'a', 'b'), 'target_file.txt') == os.path.join(temp_dir, 'target_file.txt')
assert locate_file(os.path.join(temp_dir, 'a', 'b', 'c', 'link_to_root', 'a', 'b'), 'non_existent.txt') is None

0 comments on commit 2806efe

Please sign in to comment.