-
-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Description
There is a potential issue in test_filelock.py
If someone where to introduce a bug (such as reintroducing #31) that caused file locking
not to secure exclusive access, no test actually fails. Instead, a warning is shown by Pytest:
(do to the nature of this kind of bug, it seems sometimes this would succeed with no warning at all)
tests/test_error.py .... [ 8%]
tests/test_filelock.py .............................................. [100%]
========================================================================= warnings summary ==========================================================================
tests/test_filelock.py::test_threaded_lock_different_lock_obj[UnixFileLock]
.../site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread t2_8
Traceback (most recent call last):
File ".../threading.py", line 1038, in _bootstrap_inner
self.run()
File "py-filelock/tests/test_filelock.py", line 187, in run
super().run()
File ".../threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "py-filelock/tests/test_filelock.py", line 234, in t_2
assert not lock_1.is_locked
AssertionError: assert not True
+ where True = <filelock._unix.UnixFileLock object at 0x1030ef3d0>.is_locked
warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================== 50 passed, 1 warning in 3.53s ===================================================================
Results found by adding the follow to py-filelock/src/filelock/_unix.py > UnixFileLock > _release
59 try:
60 os.remove(self._lock_file)
61 except OSError:
62 pass
The issue seems to be that the test test_filelock.py::test_threaded_lock_different_lock_obj[UnixFileLock] is failing with a AssertionError exception. However, only RuntimeError's are caught in threads created during the testing process.
Metadata
Metadata
Assignees
Labels
No labels