Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# run: |
# pytest
- name: Test with pytest
run: |
cd src/praisonai && python -m pytest
16 changes: 8 additions & 8 deletions .github/workflows/test-comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,28 @@ jobs:

case $TEST_TYPE in
"unit")
python tests/test_runner.py --pattern unit
cd src/praisonai && python tests/test_runner.py --pattern unit
;;
"integration")
python tests/test_runner.py --pattern integration
cd src/praisonai && python tests/test_runner.py --pattern integration
;;
"fast")
python tests/test_runner.py --pattern fast
cd src/praisonai && python tests/test_runner.py --pattern fast
;;
"performance")
python tests/test_runner.py --pattern "performance"
cd src/praisonai && python tests/test_runner.py --pattern "performance"
;;
"frameworks")
python tests/test_runner.py --pattern frameworks
cd src/praisonai && python tests/test_runner.py --pattern frameworks
;;
"autogen")
python tests/test_runner.py --pattern autogen
cd src/praisonai && python tests/test_runner.py --pattern autogen
;;
"crewai")
python tests/test_runner.py --pattern crewai
cd src/praisonai && python tests/test_runner.py --pattern crewai
;;
"all"|*)
python tests/test_runner.py --pattern all
cd src/praisonai && python tests/test_runner.py --pattern all
;;
esac

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ jobs:

- name: Run Unit Tests
run: |
python -m pytest tests/unit/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=term-missing
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=term-missing

- name: Run Integration Tests
run: |
python -m pytest tests/integration/ -v --tb=short --disable-warnings
cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings

- name: Run AutoGen Framework Tests
run: |
echo "🤖 Testing AutoGen Framework Integration..."
python tests/test_runner.py --pattern autogen --verbose || echo "⚠️ AutoGen tests completed with issues"
cd src/praisonai && python tests/test_runner.py --pattern autogen --verbose || echo "⚠️ AutoGen tests completed with issues"
continue-on-error: true

- name: Run CrewAI Framework Tests
run: |
echo "⛵ Testing CrewAI Framework Integration..."
python tests/test_runner.py --pattern crewai --verbose || echo "⚠️ CrewAI tests completed with issues"
cd src/praisonai && python tests/test_runner.py --pattern crewai --verbose || echo "⚠️ CrewAI tests completed with issues"
continue-on-error: true

- name: Run Legacy Tests
run: |
python -m pytest tests/test.py -v --tb=short --disable-warnings
cd src/praisonai && python -m pytest tests/test.py -v --tb=short --disable-warnings

- name: Upload Coverage Reports
if: matrix.python-version == '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
import time
import sys
import statistics
sys.path.insert(0, 'src/praisonai-agents')
sys.path.insert(0, 'src/praisonai')

print('🏃 Testing agent creation performance...')
times = []
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-frameworks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Test ${{ matrix.framework }} Framework
run: |
echo "🧪 Testing ${{ matrix.framework }} framework integration with Python ${{ matrix.python-version }}"
python tests/test_runner.py --pattern ${{ matrix.framework }} --verbose --coverage
cd src/praisonai && python tests/test_runner.py --pattern ${{ matrix.framework }} --verbose --coverage
continue-on-error: false

- name: Generate Framework Test Report
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-real.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ jobs:
if: ${{ github.event.inputs.framework == 'autogen' || github.event.inputs.framework == 'all' }}
run: |
echo "🤖 Running REAL AutoGen tests (⚠️ API costs may apply)"
python -m pytest tests/e2e/autogen/ -v -m real --tb=short
cd src/praisonai && python -m pytest tests/e2e/autogen/ -v -m real --tb=short
continue-on-error: false

- name: Run Real CrewAI Tests
if: ${{ github.event.inputs.framework == 'crewai' || github.event.inputs.framework == 'all' }}
run: |
echo "⛵ Running REAL CrewAI tests (⚠️ API costs may apply)"
python -m pytest tests/e2e/crewai/ -v -m real --tb=short
cd src/praisonai && python -m pytest tests/e2e/crewai/ -v -m real --tb=short
continue-on-error: false

- name: Generate Real Test Report
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ jobs:
- name: Find Researcher Role Source
run: |
echo "🔍 Hunting for the mysterious 'Researcher' role..."
cd src/praisonai
python -c "
import os
import yaml
import glob

print('📋 Searching for Researcher role in all YAML files:')
yaml_files = glob.glob('tests/*.yaml')
yaml_files = glob.glob('src/praisonai/tests/*.yaml')
Comment thread
MervinPraison marked this conversation as resolved.

for yaml_file in yaml_files:
try:
Expand Down Expand Up @@ -139,6 +140,7 @@ jobs:
- name: Trace AutoGen Execution Path
run: |
echo "🔍 Tracing AutoGen execution to find where it diverges..."
cd src/praisonai
python -c "
import os
import sys
Expand All @@ -163,7 +165,7 @@ jobs:

# Load the YAML to check what it contains
import yaml
with open('tests/autogen-agents.yaml', 'r') as f:
with open('src/praisonai/tests/autogen-agents.yaml', 'r') as f:
config = yaml.safe_load(f)

framework = agents_gen.framework or config.get('framework')
Expand Down Expand Up @@ -209,13 +211,14 @@ jobs:
- name: Debug YAML Loading and Roles
run: |
echo "🔍 Tracing YAML file loading and role creation..."
cd src/praisonai
python -c "
import os
import sys
import yaml
sys.path.insert(0, '.')

print('📁 Available YAML files in tests/:')
print('📁 Available YAML files in src/praisonai/tests/:')
import glob
yaml_files = glob.glob('tests/*.yaml')
for f in yaml_files:
Expand Down Expand Up @@ -297,6 +300,7 @@ jobs:
- name: Debug PraisonAIModel API Key Flow
run: |
echo "🔍 Testing PraisonAIModel API key handling..."
cd src/praisonai
python -c "
import os
import sys
Expand Down Expand Up @@ -351,12 +355,13 @@ jobs:
- name: Test Direct PraisonAI Execution
run: |
echo "🧪 Testing direct PraisonAI execution (what works locally)..."
python -m praisonai tests/autogen-agents.yaml
python -m praisonai src/praisonai/tests/autogen-agents.yaml
continue-on-error: true

- name: Comprehensive Execution Debug
run: |
echo "🔍 Comprehensive debugging of PraisonAI execution path..."
cd src/praisonai
python -c "
import os
import sys
Expand All @@ -376,10 +381,10 @@ jobs:
print(f' {f}')

print()
print('📋 Files in tests/ directory:')
print('📋 Files in src/praisonai/tests/ directory:')
for f in os.listdir('tests'):
if f.endswith('.yaml'):
print(f' tests/{f}')
print(f' src/praisonai/tests/{f}')

# Check if root agents.yaml exists
print()
Expand All @@ -401,7 +406,7 @@ jobs:
from praisonai.agents_generator import AgentsGenerator

# Test with full path
test_file = 'tests/autogen-agents.yaml'
test_file = 'src/praisonai/tests/autogen-agents.yaml'
print(f' Using test file: {test_file}')
print(f' File exists: {os.path.exists(test_file)}')

Expand Down Expand Up @@ -465,11 +470,11 @@ jobs:
- name: Run Fast Tests
run: |
# Run the fastest, most essential tests
python tests/test_runner.py --pattern fast
cd src/praisonai && python tests/test_runner.py --pattern fast

- name: Run Legacy Example Tests
run: |
python -m pytest tests/test.py -v --tb=short --disable-warnings
cd src/praisonai && python -m pytest tests/test.py -v --tb=short --disable-warnings
continue-on-error: true

- name: Restore Root Config Files
Expand Down
5 changes: 4 additions & 1 deletion src/praisonai-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ all = [
"praisonaiagents[llm]",
"praisonaiagents[mcp]",
"praisonaiagents[api]"
]
]

[tool.setuptools]
packages = ["praisonaiagents"]
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/praisonai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Homepage = "https://docs.praison.ai"
Repository = "https://github.com/mervinpraison/PraisonAI"

[tool.setuptools]
packages = ["PraisonAI"]
packages = ["praisonai"]

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,36 @@

import sys
import os
import pytest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect path manipulation.

The current path insertion attempts to add a 'src' subdirectory relative to the test file location, but this would point to a non-existent directory (src/praisonai/tests/unit/agent/src/). Since this test file is already within the src/praisonai/ structure, this path manipulation is unnecessary and incorrect.

-sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))

The import on line 12 should work correctly without this path manipulation since the test is being run from the proper directory context according to the updated GitHub Actions workflows.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
🤖 Prompt for AI Agents
In src/praisonai/tests/unit/agent/test_mini_agents_sequential.py at line 10,
remove the line that inserts 'src' into sys.path because it incorrectly
constructs a path that does not exist relative to the test file. Since the test
runs within the correct directory context, this path manipulation is unnecessary
and should be deleted to avoid import errors.


from praisonaiagents import Agent, Agents
from unittest.mock import patch

def test_mini_agents_sequential_data_passing():
def mock_completion(*args, **kwargs):
"""Mock completion function to avoid calling actual OpenAI API"""
class MockResponse:
def __init__(self, content):
self.content = content
self.choices = [type('obj', (object,), {'message': type('obj', (object,), {'content': content})})]

if 'messages' in kwargs:
if any('Generate the number 42' in str(m.get('content', '')) for m in kwargs.get('messages', [])):
return MockResponse("42")
elif any('multiply it by 2' in str(m.get('content', '')) for m in kwargs.get('messages', [])):
return MockResponse("84")
return MockResponse("mock response")

@patch('praisonaiagents.llms.PraisonAIModel.chat', side_effect=mock_completion)
@patch('praisonaiagents.llms.PraisonAIModel.stream_chat', side_effect=mock_completion)
def test_mini_agents_sequential_data_passing(mock_stream, mock_chat):
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
"""Test that output from previous task is passed to next task in Mini Agents"""

print("Testing Mini Agents Sequential Data Passing...")

# Create two agents for sequential processing
agent1 = Agent(instructions="Generate the number 42 as your output. Only return the number 42, nothing else.")
agent2 = Agent(instructions="Take the input number and multiply it by 2. Only return the result number, nothing else.")
agent1 = Agent(instructions="Generate the number 42 as your output. Only return the number 42, nothing else.", model_name="gpt-3.5-turbo")
agent2 = Agent(instructions="Take the input number and multiply it by 2. Only return the result number, nothing else.", model_name="gpt-3.5-turbo")

# Create agents with sequential processing (Mini Agents pattern)
agents = Agents(agents=[agent1, agent2], verbose=True)
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion tests/e2e/crewai/__init__.py

This file was deleted.

Loading
Loading