68 lines
1.4 KiB
Python
68 lines
1.4 KiB
Python
"""Test configuration and fixtures for CLI Command Memory."""
|
|
|
|
import os
|
|
import tempfile
|
|
import pytest
|
|
from cli_memory.config import Config
|
|
|
|
|
|
@pytest.fixture
|
|
def temp_dir():
|
|
"""Provide a temporary directory."""
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
yield tmpdir
|
|
|
|
|
|
@pytest.fixture
|
|
def config():
|
|
"""Provide a Config instance."""
|
|
return Config()
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_project_data():
|
|
"""Provide sample project data."""
|
|
return {
|
|
"name": "test-project",
|
|
"path": "/tmp/test",
|
|
"git_remote": "https://github.com/user/test.git",
|
|
"tech_stack": ["python", "docker"],
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_command_data():
|
|
"""Provide sample command data."""
|
|
return {
|
|
"command": "git status",
|
|
"command_type": "git",
|
|
"exit_code": 0,
|
|
"duration_ms": 50,
|
|
"working_directory": "/home/user/project",
|
|
"tags": ["git", "status"],
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_workflow_data():
|
|
"""Provide sample workflow data."""
|
|
return {
|
|
"name": "Test Workflow",
|
|
"description": "A test workflow",
|
|
"commands": [
|
|
{"command": "git status", "command_type": "git"},
|
|
{"command": "git add .", "command_type": "git"},
|
|
],
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def env_override():
|
|
"""Provide environment variable override context."""
|
|
original_env = os.environ.copy()
|
|
|
|
yield
|
|
|
|
os.environ.clear()
|
|
os.environ.update(original_env)
|