-
-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Description
During upgrade of the filelock package for OpenIndiana from version 3.11.0 to version 3.12.0 I noticed that one test fails (with version 3.11.0 all tests passed):
______________ test_bad_lock_file[current_directory-UnixFileLock] ______________
lock_type = <class 'filelock._unix.UnixFileLock'>
expected_error = <class 'IsADirectoryError'>, match = 'Is a directory'
bad_lock_file = '.'
@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
@pytest.mark.parametrize(
("expected_error", "match", "bad_lock_file"),
[
pytest.param(FileNotFoundError, "No such file or directory:", "a/b", id="non_existent_directory"),
pytest.param(FileNotFoundError, "No such file or directory:", "", id="blank_filename"),
pytest.param(ValueError, "embedded null (byte|character)", "\0", id="null_byte"),
pytest.param(
PermissionError if sys.platform == "win32" else IsADirectoryError,
"Permission denied:" if sys.platform == "win32" else "Is a directory",
".",
id="current_directory",
),
]
+ [pytest.param(OSError, "Invalid argument", i, id=f"invalid_{i}", marks=WindowsOnly) for i in '<>:"|?*\a']
+ [pytest.param(PermissionError, "Permission denied:", i, id=f"permission_{i}", marks=WindowsOnly) for i in "/\\"],
)
@pytest.mark.timeout(5) # timeout in case of infinite loop
def test_bad_lock_file(
lock_type: type[BaseFileLock],
expected_error: type[Exception],
match: str,
bad_lock_file: str,
) -> None:
lock = lock_type(bad_lock_file)
with pytest.raises(expected_error, match=match):
> lock.acquire()
tests/test_filelock.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../prototype/i386/usr/lib/python3.9/vendor-packages/filelock/_api.py:217: in acquire
self._acquire()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <filelock._unix.UnixFileLock object at 0x7fffa83972e0>
def _acquire(self) -> None:
open_flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC
> fd = os.open(self.lock_file, open_flags, self._context.mode)
E OSError: [Errno 22] Invalid argument: '.'
../prototype/i386/usr/lib/python3.9/vendor-packages/filelock/_unix.py:36: OSError
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels