Files
Timmy-time-dashboard/tests/tools/test_path_resolution.py
Alexander Whitestone 89cfe1be0d fix: Docker-first test suite, UX improvements, and bug fixes (#100)
Dashboard UX:
- Restructure nav from 22 flat links to 6 core + MORE dropdown
- Add mobile nav section labels (Core, Intelligence, Agents, System, Commerce)
- Defer marked.js and dompurify.js loading, consolidate CDN to jsdelivr
- Optimize font weights (drop unused 300/500), bump style.css cache buster
- Remove duplicate HTMX load triggers from sidebar and health panels

Bug fixes:
- Fix Timmy showing OFFLINE by registering after swarm recovery sweep
- Fix ThinkingEngine await bug with asyncio.run_coroutine_threadsafe
- Fix chat auto-scroll by calling scrollChat() after history partial loads
- Add missing /voice/button page and /voice/command endpoint
- Fix Grok api_key="" treated as falsy falling through to env key
- Fix self_modify PROJECT_ROOT using settings.repo_root instead of __file__

Docker test infrastructure:
- Bind-mount hands/, docker/, Dockerfiles, and compose files into test container
- Add fontconfig + fonts-dejavu-core for creative/assembler TextClip tests
- Initialize minimal git repo in Dockerfile.test for GitSafety compatibility
- Fix introspection and path resolution tests for Docker /app context

All 1863 tests pass in Docker (0 failures, 77 skipped).

Co-authored-by: Alexander Payne <apayne@MM.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:14:37 -05:00

46 lines
1.3 KiB
Python

"""Tests for path resolution in file operations."""
import pytest
from pathlib import Path
def test_resolve_path_expands_tilde():
"""Path resolution should expand ~ to home directory."""
from creative.tools.file_ops import _resolve_path
result = _resolve_path("~/test")
# Should expand to current user's home directory
assert result.as_posix() == (Path.home() / "test").as_posix()
def test_resolve_path_relative_to_repo():
"""Relative paths should resolve to repo root."""
from creative.tools.file_ops import _resolve_path
result = _resolve_path("src/config.py")
# In Docker the repo root is /app; locally it contains Timmy-time-dashboard
assert result.name == "config.py"
assert "src" in str(result)
def test_resolve_path_absolute():
"""Absolute paths should work as-is."""
from creative.tools.file_ops import _resolve_path
result = _resolve_path("/etc/hosts")
assert result.name == "hosts"
def test_resolve_path_with_custom_base():
"""Custom base_dir should override repo root."""
from creative.tools.file_ops import _resolve_path
result = _resolve_path("test.py", base_dir="/tmp")
# Handle macOS /private/tmp vs /tmp
assert result.name == "test.py"
assert "tmp" in result.as_posix()