Compare commits
1 Commits
burn/255-1
...
fix/499-ha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9930d25786 |
@@ -69,7 +69,7 @@ class OwnedTwilioNumber:
|
||||
|
||||
|
||||
def _hermes_home() -> Path:
|
||||
return Path(os.environ.get("HERMES_HOME", "~/.hermes")).expanduser()
|
||||
return Path(os.environ.get("HERMES_HOME", str(Path.home() / ".hermes")))
|
||||
|
||||
|
||||
def _env_path() -> Path:
|
||||
|
||||
0
tests/optional_skills/__init__.py
Normal file
0
tests/optional_skills/__init__.py
Normal file
43
tests/optional_skills/test_no_hardcoded_paths.py
Normal file
43
tests/optional_skills/test_no_hardcoded_paths.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""Tests for hardcoded path fixes in optional skills."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hermes_agent_root():
|
||||
return Path(__file__).parent.parent.parent
|
||||
|
||||
|
||||
class TestNoHardcodedPaths:
|
||||
def test_telephony_no_tilde_default(self, hermes_agent_root):
|
||||
"""telephony.py should not use ~/.hermes as a default path."""
|
||||
telephony = hermes_agent_root / "optional-skills/productivity/telephony/scripts/telephony.py"
|
||||
content = telephony.read_text()
|
||||
# The _hermes_home function should not use ~/
|
||||
lines = content.split("\n")
|
||||
for line in lines:
|
||||
if "_hermes_home" in line and "def " not in line:
|
||||
assert '"~/.hermes"' not in line, f"Hardcoded ~/.hermes found in telephony.py: {line.strip()}"
|
||||
|
||||
def test_memento_uses_path_home(self, hermes_agent_root):
|
||||
"""memento_cards.py should use Path.home() not hardcoded paths."""
|
||||
memento = hermes_agent_root / "optional-skills/productivity/memento-flashcards/scripts/memento_cards.py"
|
||||
content = memento.read_text()
|
||||
assert "Path.home()" in content, "memento_cards.py should use Path.home()"
|
||||
|
||||
def test_canvas_no_hardcoded_home(self, hermes_agent_root):
|
||||
"""canvas_api.py docstrings are OK, but code should not hardcode paths."""
|
||||
canvas = hermes_agent_root / "optional-skills/productivity/canvas/scripts/canvas_api.py"
|
||||
content = canvas.read_text()
|
||||
# Check that there's no code (non-docstring) using ~/.hermes as a path
|
||||
lines = content.split("\n")
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if stripped.startswith("#") or stripped.startswith('"'):
|
||||
continue # comments and strings are OK
|
||||
if "~/.hermes" in stripped and ("Path(" in stripped or "os.path" in stripped):
|
||||
pytest.fail(f"Hardcoded ~/.hermes path in code: {stripped}")
|
||||
Reference in New Issue
Block a user