Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Mocks for sleep in tests (#234)

Dmitrii Khizbullin16209d2c6f6e
diff --git a/.github/workflows/pytest_apps.yml b/.github/workflows/pytest_apps.yml
index 53955d342..e625e34f8 100644
--- a/.github/workflows/pytest_apps.yml
+++ b/.github/workflows/pytest_apps.yml
@@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- pip install flake8 pytest
+ pip install flake8 pytest mock
pip install gradio
pip install -e .
- name: Test with pytest
@@ -62,7 +62,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- pip install flake8 pytest
+ pip install flake8 pytest mock
pip install -e .
- name: Test with pytest
env:
diff --git a/examples/test/test_ai_society_example.py b/examples/test/test_ai_society_example.py
index 4787173d1..89410bcb2 100644
--- a/examples/test/test_ai_society_example.py
+++ b/examples/test/test_ai_society_example.py
@@ -11,18 +11,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
-import pytest
+from mock import patch
import examples.ai_society.role_playing
import examples.function_call.role_playing_with_function
from camel.typing import ModelType
def test_ai_society_role_playing_example():
- examples.ai_society.role_playing.main(ModelType.STUB)
+ with patch('time.sleep', return_value=None):
+ examples.ai_society.role_playing.main(ModelType.STUB)
def test_role_playing_with_function_example():
- examples.function_call.role_playing_with_function.main(ModelType.STUB)
+ with patch('time.sleep', return_value=None):
+ examples.function_call.role_playing_with_function.main(ModelType.STUB)
diff --git a/examples/test/test_code_example.py b/examples/test/test_code_example.py
index a08c08993..a6d2c2c75 100644
--- a/examples/test/test_code_example.py
+++ b/examples/test/test_code_example.py
@@ -11,12 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
-import pytest
+from mock import patch
import examples.code.role_playing
from camel.typing import ModelType
def test_code_role_playing_example():
- examples.code.role_playing.main(ModelType.STUB)
+ with patch('time.sleep', return_value=None):
+ examples.code.role_playing.main(ModelType.STUB)
diff --git a/examples/test/test_single_agent.py b/examples/test/test_single_agent.py
index caf8790fd..e5259d8da 100644
--- a/examples/test/test_single_agent.py
+++ b/examples/test/test_single_agent.py
@@ -36,7 +36,9 @@ def test_misalignment_single_agent(model):
examples.misalignment.single_agent.main(model=model)
-@parametrize
+ ModelType.STUB,
+])
def test_evaluation_single_agent(model):
examples.evaluation.single_agent.main(model=model)