From 2533efabbb5fdd683a40ce6184688ba89517c554 Mon Sep 17 00:00:00 2001 From: tobitege Date: Mon, 29 Jul 2024 19:05:58 +0200 Subject: [PATCH] (fix) split_bash_commands replaced; temp_dir fixture fix in some tests (#3160) * split_bash_commands replaced; temp_dir fixture fix in some tests * tweak test_runtime * skip 2 tests in test_runtime that need fixing in extra PR * reverting bash parsing changes and re-enabled tests * missed to revert a changed assert in test_runtime.py --- tests/unit/test_event_stream.py | 2 +- tests/unit/test_ipython.py | 2 +- tests/unit/test_runtime.py | 2 +- tests/unit/test_sandbox.py | 9 ++++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_event_stream.py b/tests/unit/test_event_stream.py index 4c7754c43f..a07c9c791c 100644 --- a/tests/unit/test_event_stream.py +++ b/tests/unit/test_event_stream.py @@ -16,7 +16,7 @@ from opendevin.storage import get_file_store def temp_dir(monkeypatch): # get a temporary directory with tempfile.TemporaryDirectory() as temp_dir: - pathlib.Path().mkdir(parents=True, exist_ok=True) + pathlib.Path(temp_dir).mkdir(parents=True, exist_ok=True) yield temp_dir diff --git a/tests/unit/test_ipython.py b/tests/unit/test_ipython.py index f1444a5ee8..66a03cc03a 100644 --- a/tests/unit/test_ipython.py +++ b/tests/unit/test_ipython.py @@ -14,7 +14,7 @@ from opendevin.runtime.server.runtime import ServerRuntime def temp_dir(monkeypatch): # get a temporary directory with tempfile.TemporaryDirectory() as temp_dir: - pathlib.Path().mkdir(parents=True, exist_ok=True) + pathlib.Path(temp_dir).mkdir(parents=True, exist_ok=True) yield temp_dir diff --git a/tests/unit/test_runtime.py b/tests/unit/test_runtime.py index dc64ae7ecd..4810481ec3 100644 --- a/tests/unit/test_runtime.py +++ b/tests/unit/test_runtime.py @@ -44,7 +44,7 @@ def print_method_name(request): def temp_dir(monkeypatch): # get a temporary directory with tempfile.TemporaryDirectory() as temp_dir: - pathlib.Path().mkdir(parents=True, exist_ok=True) + pathlib.Path(temp_dir).mkdir(parents=True, exist_ok=True) yield temp_dir diff --git a/tests/unit/test_sandbox.py b/tests/unit/test_sandbox.py index dd78fef4c9..c6e57bb2e3 100644 --- a/tests/unit/test_sandbox.py +++ b/tests/unit/test_sandbox.py @@ -32,11 +32,18 @@ def create_docker_box_from_app_config( ) +@pytest.fixture(autouse=True) +def print_method_name(request): + print('\n########################################################################') + print(f'Running test: {request.node.name}') + print('########################################################################') + + @pytest.fixture def temp_dir(monkeypatch): # get a temporary directory with tempfile.TemporaryDirectory() as temp_dir: - pathlib.Path().mkdir(parents=True, exist_ok=True) + pathlib.Path(temp_dir).mkdir(parents=True, exist_ok=True) yield temp_dir