- Fixed undefined 'tool' variable in display_history function - Changed '[tool]' markup tag usage to proper Rich syntax - All tests now pass (38/38 unit tests) - Type checking passes with mypy --strict
79 lines
1.8 KiB
Python
79 lines
1.8 KiB
Python
"""Pytest configuration for shell-speak tests."""
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
os.environ["SHELL_SPEAK_DATA_DIR"] = tempfile.mkdtemp()
|
|
os.environ["SHELL_SPEAK_HISTORY_FILE"] = os.path.join(tempfile.mkdtemp(), "history.json")
|
|
os.environ["SHELL_SPEAK_CORRECTIONS_FILE"] = os.path.join(tempfile.mkdtemp(), "corrections.json")
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_docker_yaml():
|
|
"""Sample docker command library for testing."""
|
|
return """
|
|
version: "1.0"
|
|
description: Docker test patterns
|
|
|
|
patterns:
|
|
- name: list_containers
|
|
description: List running containers
|
|
patterns:
|
|
- list running containers
|
|
- show running containers
|
|
template: docker ps
|
|
explanation: Lists all running containers.
|
|
|
|
- name: run_container
|
|
description: Run a new container
|
|
patterns:
|
|
- run a container
|
|
- start a new container
|
|
template: docker run -d --name {name} {image}
|
|
explanation: Starts a new container.
|
|
"""
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_git_yaml():
|
|
"""Sample git command library for testing."""
|
|
return """
|
|
version: "1.0"
|
|
description: Git test patterns
|
|
|
|
patterns:
|
|
- name: git_status
|
|
description: Show working tree status
|
|
patterns:
|
|
- git status
|
|
- check status
|
|
template: git status
|
|
explanation: Shows the current status.
|
|
|
|
- name: git_commit
|
|
description: Commit changes
|
|
patterns:
|
|
- commit changes
|
|
- make commit
|
|
template: git commit -m "{message}"
|
|
explanation: Records changes with a message.
|
|
"""
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_corrections_json():
|
|
"""Sample corrections JSON for testing."""
|
|
return {
|
|
"version": "1.0",
|
|
"corrections": {
|
|
"custom:my custom query": "echo custom command",
|
|
"docker:show running containers": "docker ps -a",
|
|
}
|
|
}
|