@@ -209,3 +209,25 @@ def test_get_file_count(self):
209209 for test_file , count in tests :
210210 result = filetype .get_file_count (os .path .join (test_dir , test_file ))
211211 assert count == result
212+
213+
214+ def SymlinkTest (FileBasedTesting ):
215+ test_data_dir = os .path .join (os .path .dirname (__file__ ), 'data' )
216+
217+ @skipIf (on_windows , 'os.symlink does not work on Windows' )
218+ def test_is_file (self ):
219+ test_file = self .get_test_loc ('symlink/test' , copy = True )
220+ temp_dir = fileutils .get_temp_dir ()
221+ test_link = join (temp_dir , 'test-link' )
222+ os .symlink (test_file , test_link )
223+ assert filetype .is_file (test_link , allow_symlinks = True )
224+ assert not filetype .is_file (test_link , allow_symlinks = False )
225+
226+ @skipIf (on_windows , 'os.symlink does not work on Windows' )
227+ def test_is_dir (self ):
228+ test_dir = self .get_test_loc ('symlink' , copy = True )
229+ temp_dir = fileutils .get_temp_dir ()
230+ test_link = join (temp_dir , 'test-dir-link' )
231+ os .symlink (test_dir , test_link )
232+ assert filetype .is_dir (test_link , allow_symlinks = True )
233+ assert not filetype .is_dir (test_link , allow_symlinks = False )
0 commit comments