[New-bugs-announce] [issue46426] Improve tests for the dir_fd argument
Serhiy Storchaka
report at bugs.python.org
Tue Jan 18 14:43:29 EST 2022
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
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.
----------
components: Tests
messages: 410882
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve tests for the dir_fd argument
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46426>
_______________________________________
More information about the New-bugs-announce
mailing list