test: skip onboarding config tests when PyYAML unavailable, remove duplicate definition — v0.50.60
Merges #564. Adds PyYAML skip guards to two onboarding tests. Removes duplicate _HAS_YAML/_needs_yaml block. No production code changed. 1319 tests pass.
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
# Hermes Web UI -- Changelog
|
# Hermes Web UI -- Changelog
|
||||||
|
|
||||||
|
## [v0.50.60] — 2026-04-16
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- **Test robustness** — two onboarding setup tests (`test_setup_allowed_with_confirm_overwrite`, `test_setup_allowed_when_no_config_exists`) now skip gracefully when PyYAML is not installed in the test environment, matching the pattern already used in `test_onboarding_mvp.py`. No production code changed. (PR #564)
|
||||||
|
|
||||||
## [v0.50.59] — 2026-04-16
|
## [v0.50.59] — 2026-04-16
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -553,7 +553,7 @@
|
|||||||
<div class="settings-section-title">System</div>
|
<div class="settings-section-title">System</div>
|
||||||
<div class="settings-section-meta">Instance version and access controls.</div>
|
<div class="settings-section-meta">Instance version and access controls.</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="settings-version-badge">v0.50.59</span>
|
<span class="settings-version-badge">v0.50.60</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-field" style="border-top:1px solid var(--border);padding-top:12px;margin-top:8px">
|
<div class="settings-field" style="border-top:1px solid var(--border);padding-top:12px;margin-top:8px">
|
||||||
<label for="settingsPassword" data-i18n="settings_label_password">Access Password</label>
|
<label for="settingsPassword" data-i18n="settings_label_password">Access Password</label>
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ from unittest import mock
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
# Skip tests that call apply_onboarding_setup → _save_yaml_config when PyYAML is missing
|
||||||
|
try:
|
||||||
|
import yaml as _yaml
|
||||||
|
_HAS_YAML = True
|
||||||
|
except ImportError:
|
||||||
|
_HAS_YAML = False
|
||||||
|
_needs_yaml = pytest.mark.skipif(not _HAS_YAML, reason="PyYAML not installed — onboarding setup tests require it")
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Unit tests — no live server needed, test logic directly via imports
|
# Unit tests — no live server needed, test logic directly via imports
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -139,6 +147,7 @@ class TestApplyOnboardingSetupGuard:
|
|||||||
)
|
)
|
||||||
assert result.get("requires_confirm") is True
|
assert result.get("requires_confirm") is True
|
||||||
|
|
||||||
|
@_needs_yaml
|
||||||
def test_setup_allowed_with_confirm_overwrite(self):
|
def test_setup_allowed_with_confirm_overwrite(self):
|
||||||
"""With confirm_overwrite=True, setup may proceed (will hit real logic)."""
|
"""With confirm_overwrite=True, setup may proceed (will hit real logic)."""
|
||||||
import api.onboarding as mod
|
import api.onboarding as mod
|
||||||
@@ -163,6 +172,7 @@ class TestApplyOnboardingSetupGuard:
|
|||||||
finally:
|
finally:
|
||||||
fake_config_path.unlink(missing_ok=True)
|
fake_config_path.unlink(missing_ok=True)
|
||||||
|
|
||||||
|
@_needs_yaml
|
||||||
def test_setup_allowed_when_no_config_exists(self):
|
def test_setup_allowed_when_no_config_exists(self):
|
||||||
"""Fresh install: no config.yaml → setup proceeds normally (no blocking error)."""
|
"""Fresh install: no config.yaml → setup proceeds normally (no blocking error)."""
|
||||||
import api.onboarding as mod
|
import api.onboarding as mod
|
||||||
@@ -232,17 +242,6 @@ requires_server = pytest.mark.skipif(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
import yaml as _yaml
|
|
||||||
_HAS_YAML = True
|
|
||||||
except ImportError:
|
|
||||||
_HAS_YAML = False
|
|
||||||
|
|
||||||
_needs_yaml = pytest.mark.skipif(
|
|
||||||
not _HAS_YAML, reason="PyYAML not installed"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@requires_server
|
@requires_server
|
||||||
class TestOnboardingGateIntegration:
|
class TestOnboardingGateIntegration:
|
||||||
"""Live-server integration tests for the onboarding gate fix."""
|
"""Live-server integration tests for the onboarding gate fix."""
|
||||||
|
|||||||
Reference in New Issue
Block a user