fix: fix test_run_command_with_output_file by avoiding overwrite
This commit is contained in:
@@ -4,9 +4,10 @@ Unit tests for cli.py module
|
||||
Tests the command-line interface for CleverAgents.
|
||||
"""
|
||||
|
||||
import os
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch, AsyncMock, MagicMock
|
||||
from unittest.mock import Mock, patch
|
||||
from click.testing import CliRunner
|
||||
import tempfile
|
||||
|
||||
@@ -157,8 +158,8 @@ class TestRunCommand:
|
||||
mock_app_class.return_value = mock_app
|
||||
mock_asyncio_run.return_value = "Test result"
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w', prefix='cleveragent_', delete=False) as output_file:
|
||||
output_path = Path(output_file.name)
|
||||
# Generate path to a non-existent file to avoid overwrite confirmation prompt
|
||||
output_path = Path(tempfile.gettempdir()) / f'cleveragent_test_{os.getpid()}_{id(self)}.txt'
|
||||
|
||||
try:
|
||||
result = runner.invoke(run, [
|
||||
|
||||
Reference in New Issue
Block a user