Skip to content

Commit 9304e4b

Browse files
committed
Improve file finder test coverage
1 parent ad48d5c commit 9304e4b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

testing/test_file_finder.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ def test_symlink_dir(inwd):
8484
})
8585

8686

87+
@pytest.mark.skipif(sys.platform == 'win32',
88+
reason="symlinks to dir not supported")
89+
def test_symlink_dir_source_not_in_scm(inwd):
90+
(inwd.cwd / 'adir' / 'bdirlink').mksymlinkto('../bdir')
91+
assert set(find_files('adir')) == _sep({
92+
'adir/filea',
93+
})
94+
95+
8796
@pytest.mark.skipif(sys.platform == 'win32',
8897
reason="symlinks to files not supported on windows")
8998
def test_symlink_file(inwd):
@@ -95,6 +104,15 @@ def test_symlink_file(inwd):
95104
})
96105

97106

107+
@pytest.mark.skipif(sys.platform == 'win32',
108+
reason="symlinks to files not supported on windows")
109+
def test_symlink_file_source_not_in_scm(inwd):
110+
(inwd.cwd / 'adir' / 'file1link').mksymlinkto('../file1')
111+
assert set(find_files('adir')) == _sep({
112+
'adir/filea',
113+
})
114+
115+
98116
@pytest.mark.skipif(sys.platform == 'win32',
99117
reason="symlinks to dir not supported")
100118
def test_symlink_loop(inwd):
@@ -106,6 +124,18 @@ def test_symlink_loop(inwd):
106124
})
107125

108126

127+
@pytest.mark.skipif(sys.platform == 'win32',
128+
reason="symlinks to dir not supported")
129+
def test_symlink_loop_outside_path(inwd):
130+
(inwd.cwd / 'bdir' / 'loop').mksymlinkto('../bdir')
131+
(inwd.cwd / 'adir' / 'bdirlink').mksymlinkto('../bdir')
132+
inwd.add_and_commit()
133+
assert set(find_files('adir')) == _sep({
134+
'adir/filea',
135+
'adir/bdirlink/fileb',
136+
})
137+
138+
109139
@pytest.mark.skipif(sys.platform == 'win32',
110140
reason="symlinks to dir not supported")
111141
def test_symlink_dir_out_of_git(inwd):

0 commit comments

Comments
 (0)