New submission from Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue46426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to