File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1265,7 +1265,7 @@ def link_to(self, target):
1265
1265
warnings .warn ("pathlib.Path.link_to() is deprecated and is scheduled "
1266
1266
"for removal in Python 3.12. "
1267
1267
"Use pathlib.Path.hardlink_to() instead." ,
1268
- DeprecationWarning )
1268
+ DeprecationWarning , stacklevel = 2 )
1269
1269
self ._accessor .link (self , target )
1270
1270
1271
1271
# Convenience functions for querying the stat results
Original file line number Diff line number Diff line change @@ -1934,7 +1934,8 @@ def test_link_to(self):
1934
1934
self .assertTrue (p .stat )
1935
1935
# Linking to a str of a relative path.
1936
1936
r = rel_join ('fileAAA' )
1937
- q .link_to (r )
1937
+ with self .assertWarns (DeprecationWarning ):
1938
+ q .link_to (r )
1938
1939
self .assertEqual (os .stat (r ).st_size , size )
1939
1940
self .assertTrue (q .stat )
1940
1941
You can’t perform that action at this time.
0 commit comments