fmu-settings 0.5.2__tar.gz → 0.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fmu-settings might be problematic. Click here for more details.
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/PKG-INFO +1 -1
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_resources/lock_manager.py +5 -1
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_version.py +3 -3
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu_settings.egg-info/PKG-INFO +1 -1
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_resources/test_lock_manager.py +15 -23
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.coveragerc +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.github/pull_request_template.md +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.github/workflows/ci.yml +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.github/workflows/codeql.yml +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.github/workflows/publish.yml +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/.gitignore +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/CONTRIBUTING.md +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/LICENSE +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/README.md +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/SECURITY.md +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/pyproject.toml +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/setup.cfg +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/__init__.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/__init__.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_fmu_dir.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_global_config.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_init.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_logging.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_resources/__init__.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_resources/config_managers.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_resources/pydantic_resource_manager.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/__init__.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/_enums.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/_mappings.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/lock_info.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/project_config.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/models/user_config.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/py.typed +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/types.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu_settings.egg-info/SOURCES.txt +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu_settings.egg-info/dependency_links.txt +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu_settings.egg-info/requires.txt +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu_settings.egg-info/top_level.txt +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/conftest.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_fmu_dir.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_global_config.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_init.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_resources/test_project_config.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_resources/test_resource_managers.py +0 -0
- {fmu_settings-0.5.2 → fmu_settings-0.5.3}/tests/test_resources/test_user_config.py +0 -0
|
@@ -32,6 +32,10 @@ class LockError(Exception):
|
|
|
32
32
|
"""Raised when the lock cannot be acquired."""
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
class LockNotFoundError(FileNotFoundError):
|
|
36
|
+
"""Raised when the lock cannot be found."""
|
|
37
|
+
|
|
38
|
+
|
|
35
39
|
class LockManager(PydanticResourceManager[LockInfo]):
|
|
36
40
|
"""Manages the .lock file."""
|
|
37
41
|
|
|
@@ -196,7 +200,7 @@ class LockManager(PydanticResourceManager[LockInfo]):
|
|
|
196
200
|
if not self.exists:
|
|
197
201
|
if self.is_acquired():
|
|
198
202
|
self.release()
|
|
199
|
-
raise
|
|
203
|
+
raise LockNotFoundError("Cannot refresh: lock file does not exist")
|
|
200
204
|
|
|
201
205
|
lock_info = self._safe_load()
|
|
202
206
|
if not lock_info or not self._is_mine(lock_info):
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.5.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 5,
|
|
31
|
+
__version__ = version = '0.5.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 5, 3)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g7953e1c0f'
|
|
@@ -19,6 +19,7 @@ from fmu.settings._resources.lock_manager import (
|
|
|
19
19
|
DEFAULT_LOCK_TIMEOUT,
|
|
20
20
|
LockError,
|
|
21
21
|
LockManager,
|
|
22
|
+
LockNotFoundError,
|
|
22
23
|
)
|
|
23
24
|
from fmu.settings.models.lock_info import LockInfo
|
|
24
25
|
|
|
@@ -493,15 +494,21 @@ def test_refresh_works_as_expected(
|
|
|
493
494
|
def test_refresh_without_lock_file(
|
|
494
495
|
fmu_dir: ProjectFMUDirectory, monkeypatch: MonkeyPatch
|
|
495
496
|
) -> None:
|
|
496
|
-
"""Tests
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
lock.refresh()
|
|
497
|
+
"""Tests that if a user deletes anothers lock it's invalidated on a refresh."""
|
|
498
|
+
with pytest.raises(LockNotFoundError, match="does not exist"):
|
|
499
|
+
fmu_dir._lock.refresh()
|
|
500
500
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
fmu_dir._lock.acquire()
|
|
502
|
+
assert fmu_dir._lock.is_acquired() is True
|
|
503
|
+
|
|
504
|
+
# Someone deletes the lock
|
|
505
|
+
fmu_dir._lock.path.unlink()
|
|
506
|
+
|
|
507
|
+
with pytest.raises(
|
|
508
|
+
LockNotFoundError, match="Cannot refresh: lock file does not exist"
|
|
509
|
+
):
|
|
510
|
+
fmu_dir._lock.refresh()
|
|
511
|
+
assert fmu_dir._lock.is_acquired() is False
|
|
505
512
|
|
|
506
513
|
|
|
507
514
|
def test_refresh_without_owning_lock(
|
|
@@ -649,18 +656,3 @@ def test_ensure_can_write_foreign_lock(fmu_dir: ProjectFMUDirectory) -> None:
|
|
|
649
656
|
pytest.raises(PermissionError, match="Cannot write to .fmu directory"),
|
|
650
657
|
):
|
|
651
658
|
lock.ensure_can_write()
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
def test_manual_delete_invalidates_lock_file_on_refresh(
|
|
655
|
-
fmu_dir: ProjectFMUDirectory,
|
|
656
|
-
) -> None:
|
|
657
|
-
"""Tests that if a user deletes anothers lock it's invalidated on a refresh."""
|
|
658
|
-
fmu_dir._lock.acquire()
|
|
659
|
-
assert fmu_dir._lock.is_acquired() is True
|
|
660
|
-
|
|
661
|
-
# Someone deletes the lock
|
|
662
|
-
fmu_dir._lock.path.unlink()
|
|
663
|
-
|
|
664
|
-
with pytest.raises(LockError, match="Cannot refresh: lock file does not exist"):
|
|
665
|
-
fmu_dir._lock.refresh()
|
|
666
|
-
assert fmu_dir._lock.is_acquired() is False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fmu_settings-0.5.2 → fmu_settings-0.5.3}/src/fmu/settings/_resources/pydantic_resource_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|