@@ -1628,11 +1628,6 @@ def cleanup():
1628
1628
# Broken symlink (pointing to itself).
1629
1629
os .symlink ('brokenLinkLoop' , join ('brokenLinkLoop' ))
1630
1630
1631
- def assertSame (self , path_a , path_b ):
1632
- self .assertTrue (os .path .samefile (str (path_a ), str (path_b )),
1633
- "%r and %r don't point to the same file" %
1634
- (path_a , path_b ))
1635
-
1636
1631
def assertFileNotFound (self , func , * args , ** kwargs ):
1637
1632
with self .assertRaises (FileNotFoundError ) as cm :
1638
1633
func (* args , ** kwargs )
@@ -1664,7 +1659,7 @@ def test_samefile(self):
1664
1659
def test_empty_path (self ):
1665
1660
# The empty path points to '.'
1666
1661
p = self .cls ('' )
1667
- self .assertEqual (p . stat ( ), os . stat ( '.' ) )
1662
+ self .assertEqual (str ( p ), '.' )
1668
1663
1669
1664
def test_exists (self ):
1670
1665
P = self .cls
@@ -1693,9 +1688,6 @@ def test_open_common(self):
1693
1688
with (p / 'fileA' ).open ('rb' ) as f:
1694
1689
self .assertIsInstance (f , io .BufferedIOBase )
1695
1690
self .assertEqual (f .read ().strip (), b"this is file A" )
1696
- with (p / 'fileA' ).open ('rb' , buffering = 0 ) as f :
1697
- self .assertIsInstance (f , io .RawIOBase )
1698
- self .assertEqual (f .read ().strip (), b"this is file A" )
1699
1691
1700
1692
def test_read_write_bytes (self ):
1701
1693
p = self .cls (BASE )
@@ -2017,7 +2009,6 @@ def test_glob_permissions(self):
2017
2009
P = self .cls
2018
2010
base = P (BASE ) / 'permissions'
2019
2011
base .mkdir ()
2020
- self .addCleanup (os_helper .rmtree , base )
2021
2012
2022
2013
for i in range (100 ):
2023
2014
link = base / f"link{ i } "
@@ -2045,8 +2036,8 @@ def test_glob_above_recursion_limit(self):
2045
2036
recursion_limit = 50
2046
2037
# directory_depth > recursion_limit
2047
2038
directory_depth = recursion_limit + 10
2048
- base = pathlib . Path ( os_helper . TESTFN , 'deep' )
2049
- path = pathlib . Path (base , * (['d' ] * directory_depth ))
2039
+ base = self . cls ( BASE , 'deep' )
2040
+ path = self . cls (base , * (['d' ] * directory_depth ))
2050
2041
path .mkdir (parents = True )
2051
2042
2052
2043
with set_recursion_limit (recursion_limit ):
@@ -2242,18 +2233,12 @@ def test_is_file_no_follow_symlinks(self):
2242
2233
2243
2234
def test_is_mount (self ):
2244
2235
P = self .cls (BASE )
2245
- if os .name == 'nt' :
2246
- R = self .cls ('c:\\ ' )
2247
- else :
2248
- R = self .cls ('/' )
2249
2236
self .assertFalse ((P / 'fileA' ).is_mount ())
2250
2237
self .assertFalse ((P / 'dirA' ).is_mount ())
2251
2238
self .assertFalse ((P / 'non-existing' ).is_mount ())
2252
2239
self .assertFalse ((P / 'fileA' / 'bah' ).is_mount ())
2253
- self .assertTrue (R .is_mount ())
2254
2240
if self .can_symlink :
2255
2241
self .assertFalse ((P / 'linkA' ).is_mount ())
2256
- self .assertIs ((R / '\udfff ' ).is_mount (), False )
2257
2242
2258
2243
def test_is_symlink (self ):
2259
2244
P = self .cls (BASE )
@@ -2496,6 +2481,12 @@ def with_segments(self, *pathsegments):
2496
2481
for dirpath , dirnames , filenames in p .walk ():
2497
2482
self .assertEqual (42 , dirpath .session_id )
2498
2483
2484
+ def test_open_unbuffered (self ):
2485
+ p = self .cls (BASE )
2486
+ with (p / 'fileA' ).open ('rb' , buffering = 0 ) as f :
2487
+ self .assertIsInstance (f , io .RawIOBase )
2488
+ self .assertEqual (f .read ().strip (), b"this is file A" )
2489
+
2499
2490
def test_resolve_nonexist_relative_issue38671 (self ):
2500
2491
p = self .cls ('non' , 'exist' )
2501
2492
@@ -2896,6 +2887,14 @@ def test_is_char_device_true(self):
2896
2887
self .assertIs (self .cls ('/dev/null\udfff ' ).is_char_device (), False )
2897
2888
self .assertIs (self .cls ('/dev/null\x00 ' ).is_char_device (), False )
2898
2889
2890
+ def test_is_mount_root (self ):
2891
+ if os .name == 'nt' :
2892
+ R = self .cls ('c:\\ ' )
2893
+ else :
2894
+ R = self .cls ('/' )
2895
+ self .assertTrue (R .is_mount ())
2896
+ self .assertFalse ((R / '\udfff ' ).is_mount ())
2897
+
2899
2898
def test_passing_kwargs_deprecated (self ):
2900
2899
with self .assertWarns (DeprecationWarning ):
2901
2900
self .cls (foo = "bar" )
0 commit comments