-
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sharpen asserts in an attempt to debug failing test
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |