Initial upload: shell-speak CLI tool with natural language to shell command conversion
This commit is contained in:
78
tests/conftest.py
Normal file
78
tests/conftest.py
Normal file
@@ -0,0 +1,78 @@
|
||||
"""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",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user