IMPORT FIX: Add sqlmodel and comprehensive PYTHONPATH setup
Issues identified from test run:
- ModuleNotFoundError: No module named 'sqlmodel'
- ModuleNotFoundError: No module named 'src' (agent-protocols)
- ModuleNotFoundError: No module named 'aitbc' (blockchain-node)
Solutions applied:
1. Add missing dependencies:
- sqlmodel (for blockchain-node database)
- sqlalchemy (for sqlmodel dependency)
2. Improve PYTHONPATH with specific paths:
- /opt/gitea-runner/workspace/repo/apps/agent-protocols/src
- /opt/gitea-runner/workspace/repo/apps/blockchain-node/src
- /opt/gitea-runner/workspace/repo/apps/coordinator-api/src
- /opt/gitea-runner/workspace/repo/cli
- /opt/gitea-runner/workspace/repo/packages/py/aitbc-crypto/src
- /opt/gitea-runner/workspace/repo/packages/py/aitbc-sdk/src
3. Applied to both jobs (test and test-specific)
Expected results:
- sqlmodel import errors resolved
- src imports resolved for agent-protocols
- aitbc imports resolved for blockchain-node
- Better import resolution across all apps
- More tests should be able to run successfully
This addresses the specific import errors seen in the test run
and provides comprehensive import path coverage for the complex project structure.
PYTHON-TESTS FIX: Avoid package installation errors
Issue: Poetry install failing with 'No file/folder found for package aitbc-cli'
Root cause: Complex setuptools package configuration in pyproject.toml
Problem: Project configured as package but with complex multi-source structure
Solution: Use --no-root flag like other workflows
Changes:
- install --no-root (both jobs)
- Skip current project installation
- Install only dependencies from poetry.lock
- Maintain all other test functionality
Benefits:
- Avoids package installation complexity
- Consistent with other workflows
- Focus on dependency installation for testing
- Clean separation of concerns
This fixes the poetry installation failure while maintaining
comprehensive test environment setup for import resolution.
DEDICATED TEST WORKFLOW: Separate testing from main CI
Creates python-tests.yml with comprehensive test handling:
Features:
- Separate workflow from main CI (keeps CI clean)
- Comprehensive Python path setup for import resolution
- Install ALL dependencies with poetry (not --no-root)
- Additional dependencies: pydantic-settings, pytest-cov, pytest-mock
- Multiple PYTHONPATH entries for complex project structure
- Two jobs: general tests + specific tests (manual trigger)
Import Error Handling:
- Full project installation (poetry install)
- Multiple Python path entries:
- /opt/gitea-runner/workspace/repo
- /opt/gitea-runner/workspace/repo/src
- /opt/gitea-runner/workspace/repo/apps
- /opt/gitea-runner/workspace/repo/apps/*/src
- Missing dependencies: pydantic-settings
- Error tolerance: --maxfail=5, --tb=short
Benefits:
- Main CI stays clean and fast
- Tests can fail without blocking CI
- Comprehensive test environment setup
- Manual trigger for specific test debugging
- Better import resolution for complex project structure
This separates concerns: CI focuses on build/deployment,
while this workflow focuses on comprehensive testing.