diff --git a/ospd_openvas/lock.py b/ospd_openvas/lock.py index 9aa23547c..a11a5fdb2 100644 --- a/ospd_openvas/lock.py +++ b/ospd_openvas/lock.py @@ -46,7 +46,7 @@ def acquire_lock(self) -> "LockFile": parent_dir = self._lock_file_path.parent parent_dir.mkdir(parents=True, exist_ok=True) - self._fd = open(self._lock_file_path, 'w') + self._fd = self._lock_file_path.open('w') except PermissionError as e: logger.error( "Failed to create lock file %s. %s", diff --git a/tests/test_lock.py b/tests/test_lock.py index aef9da37c..6f738e102 100644 --- a/tests/test_lock.py +++ b/tests/test_lock.py @@ -25,6 +25,7 @@ from unittest.mock import patch, MagicMock from ospd_openvas.lock import LockFile +from .helper import assert_called_once class LockFileTestCase(unittest.TestCase):