add typing for tmp dir fixture

This commit is contained in:
Xingyao Wang
2024-07-30 13:30:43 -04:00
parent 3067553f3c
commit fc1070b9d9
5 changed files with 15 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
import json
import pytest
from pytest import TempPathFactory
from opendevin.events import EventSource, EventStream
from opendevin.events.action import (
@@ -11,8 +12,8 @@ from opendevin.storage import get_file_store
@pytest.fixture
def temp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('test_event_stream')
def temp_dir(tmp_path_factory: TempPathFactory) -> str:
return str(tmp_path_factory.mktemp('test_event_stream'))
def collect_events(stream):

View File

@@ -2,6 +2,7 @@ import logging
from unittest.mock import Mock, patch
import pytest
from pytest import TempPathFactory
from opendevin.controller.agent_controller import AgentController
from opendevin.controller.state.state import State
@@ -28,8 +29,8 @@ logging.basicConfig(level=logging.DEBUG)
@pytest.fixture
def temp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('test_is_stuck')
def temp_dir(tmp_path_factory: TempPathFactory) -> str:
return str(tmp_path_factory.mktemp('test_is_stuck'))
@pytest.fixture

View File

@@ -4,6 +4,7 @@ from unittest.mock import MagicMock
import pytest
import yaml
from pytest import TempPathFactory
from agenthub.micro.registry import all_microagents
from opendevin.controller.agent import Agent
@@ -16,8 +17,8 @@ from opendevin.storage import get_file_store
@pytest.fixture
def temp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('test_micro_agents')
def temp_dir(tmp_path_factory: TempPathFactory) -> str:
return str(tmp_path_factory.mktemp('test_micro_agents'))
@pytest.fixture

View File

@@ -6,6 +6,7 @@ import time
from unittest.mock import patch
import pytest
from pytest import TempPathFactory
from opendevin.core.config import AppConfig, SandboxConfig, load_from_env
from opendevin.core.logger import opendevin_logger as logger
@@ -39,8 +40,8 @@ def print_method_name(request):
@pytest.fixture
def temp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('test_runtime')
def temp_dir(tmp_path_factory: TempPathFactory) -> str:
return str(tmp_path_factory.mktemp('test_runtime'))
TEST_RUNTIME = os.getenv('TEST_RUNTIME', 'both')

View File

@@ -5,6 +5,7 @@ from unittest.mock import MagicMock, patch
import pytest
import toml
from pytest import TempPathFactory
from opendevin.runtime.utils.runtime_build import (
_generate_dockerfile,
@@ -19,8 +20,8 @@ RUNTIME_IMAGE_PREFIX = 'od_runtime'
@pytest.fixture
def temp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('test_runtime_build')
def temp_dir(tmp_path_factory: TempPathFactory) -> str:
return str(tmp_path_factory.mktemp('test_runtime_build'))
def test_put_source_code_to_dir(temp_dir):