This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve tests for the dir_fd argument
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2022-01-18 19:43 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30668 merged serhiy.storchaka, 2022-01-18 19:46
PR 30739 merged miss-islington, 2022-01-21 07:54
PR 30757 merged serhiy.storchaka, 2022-01-21 17:30
Messages (4)
msg410882 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-01-18 19:43
There is a flaw in tests for the dir_fd argument in test_posix. All these tests open a current directory as dir_fd, so all paths are relative to the current directory. They will pass in case of the following errors:

1. dir_fd, src_dir_fd or dst_dir_fd are completely ignored.
2. The meaning of src_dir_fd and dst_dir_fd is opposite.

The proposed PR rewrites these tests. It is ensure that directory file descriptors refer to directories different from the current directory, and that src_dir_fd and dst_dir_fd refer to different directories, and that all tested filenames are unique, so files cannot be confused with existing diles in different directories.

Also add context manager open_dir_fd() in test.support.os_helper. It may be helpful in other tests for the dir_fd argument.
msg411091 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-01-21 07:55
New changeset 54610bb448a9cf5be77d53b66169fca4c11be6cb by Serhiy Storchaka in branch 'main':
bpo-46426: Improve tests for the dir_fd argument (GH-30668)
https://github.com/python/cpython/commit/54610bb448a9cf5be77d53b66169fca4c11be6cb
msg411156 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-01-21 17:31
New changeset a1015c6478e8cbec2ecb984a3cba733783d168b5 by Miss Islington (bot) in branch '3.10':
bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30739)
https://github.com/python/cpython/commit/a1015c6478e8cbec2ecb984a3cba733783d168b5
msg411459 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-01-24 10:14
New changeset 3f1ea163ea54513e00e0e9d5442fee1b639825cc by Serhiy Storchaka in branch '3.9':
[3.9] bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30757)
https://github.com/python/cpython/commit/3f1ea163ea54513e00e0e9d5442fee1b639825cc
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90584
2022-01-24 10:25:33serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-24 10:14:46serhiy.storchakasetmessages: + msg411459
2022-01-21 17:31:34serhiy.storchakasetmessages: + msg411156
2022-01-21 17:30:13serhiy.storchakasetpull_requests: + pull_request28944
2022-01-21 07:55:01serhiy.storchakasetmessages: + msg411091
2022-01-21 07:54:58miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28926
2022-01-18 19:46:19serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request28868
2022-01-18 19:43:29serhiy.storchakacreate