Skip to content

Commit 16092d2

Browse files
Merge pull request #254 from acsone/finder-coverage
File finder test coverage
2 parents ad48d5c + e8682df commit 16092d2

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

testing/test_file_finder.py

Lines changed: 32 additions & 2 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):
@@ -149,7 +179,7 @@ def test_empty_subdir(inwd):
149179

150180

151181
@pytest.mark.skipif(sys.platform == 'win32',
152-
reason="symlinks to files not supported on windows")
182+
reason="symlinks not supported on windows")
153183
def test_double_include_through_symlink(inwd):
154184
(inwd.cwd / 'data').ensure(dir=True)
155185
(inwd.cwd / 'data' / 'datafile').ensure(file=True)
@@ -167,7 +197,7 @@ def test_double_include_through_symlink(inwd):
167197

168198

169199
@pytest.mark.skipif(sys.platform == 'win32',
170-
reason="symlinks to files not supported on windows")
200+
reason="symlinks not supported on windows")
171201
def test_symlink_not_in_scm_while_target_is(inwd):
172202
(inwd.cwd / 'data').ensure(dir=True)
173203
(inwd.cwd / 'data' / 'datafile').ensure(file=True)

0 commit comments

Comments
 (0)