[issue39950] Add pathlib.Path.hardlink_to()

Karthikeyan Singaravelan report at bugs.python.org
Mon May 3 04:12:53 EDT 2021


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

The changes have introduced deprecation warnings in tests. It seems https://github.com/python/cpython/blob/ad106c68eb00f5e4af2f937107baff6141948cee/Lib/test/test_pathlib.py#L1937 is not covered.

./python -Wall -m test test_pathlib                      
0:00:00 load avg: 0.81 Run tests sequentially
0:00:00 load avg: 0.81 [1/1] test_pathlib
/root/cpython/Lib/pathlib.py:1265: DeprecationWarning: pathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead.
  warnings.warn("pathlib.Path.link_to() is deprecated and is scheduled "
/root/cpython/Lib/pathlib.py:1265: DeprecationWarning: pathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead.
  warnings.warn("pathlib.Path.link_to() is deprecated and is scheduled "

== Tests result: SUCCESS ==

1 test OK.

Total duration: 2.9 sec
Tests result: SUCCESS

Also it will be nice to point to the line causing deprecation instead of the library soruce code that will help users identify the deprecated usage. Using stacklevel=2 might help here https://docs.python.org/3/library/warnings.html#warnings.warn


./python -Wall -m test test_pathlib  
0:00:00 load avg: 1.82 Run tests sequentially
0:00:00 load avg: 1.82 [1/1] test_pathlib
/root/cpython/Lib/test/test_pathlib.py:1937: DeprecationWarning: pathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead.
  q.link_to(r)
/root/cpython/Lib/test/test_pathlib.py:1937: DeprecationWarning: pathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead.
  q.link_to(r)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 4.3 sec
Tests result: SUCCESS

----------
nosy: +xtreak

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39950>
_______________________________________


More information about the Python-bugs-list mailing list