@@ -238,6 +238,13 @@ def test_relative_to(self):
238238 with self .assertRaises (ValueError ):
239239 self .path ('passwd' ).relative_to ('/usr' )
240240
241+ @unittest .skipIf (sys .version_info < (3 , 9 ) or pathlib2 ,
242+ 'readlink new in Python 3.9' )
243+ def test_is_relative_to (self ):
244+ path = self .path ('/etc/passwd' )
245+ self .assertTrue (path .is_relative_to ('/etc' ))
246+ self .assertFalse (path .is_relative_to ('/src' ))
247+
241248 def test_with_name (self ):
242249 self .check_windows_only ()
243250 self .assertEqual (
@@ -664,6 +671,16 @@ def test_pathlib2_does_not_have_link_to(self):
664671 path .link_to (link_name )
665672 self .assertFalse (self .os .path .exists (link_name ))
666673
674+ @unittest .skipIf (sys .version_info < (3 , 9 ) or pathlib2 ,
675+ 'readlink new in Python 3.9' )
676+ def test_readlink (self ):
677+ self .skip_if_symlink_not_supported ()
678+ link_path = self .make_path ('foo' , 'bar' , 'baz' )
679+ target = self .make_path ('tarJAY' )
680+ self .create_symlink (link_path , target )
681+ path = self .path (link_path )
682+ self .assert_equal_paths (path .readlink (), self .path (target ))
683+
667684 def test_mkdir (self ):
668685 dir_name = self .make_path ('foo' , 'bar' )
669686 self .assert_raises_os_error (errno .ENOENT ,
@@ -1074,4 +1091,4 @@ def test_add_existing_real_directory_with_pathlib_path(self):
10741091
10751092
10761093if __name__ == '__main__' :
1077- unittest .main ()
1094+ unittest .main (verbosity = 2 )
0 commit comments