fix: add database setup and resolve final import issues
Some checks failed
audit / audit (push) Has been skipped
ci-cd / build (push) Has been skipped
ci / build (push) Has been skipped
autofix / fix (push) Has been skipped
python-tests / test (push) Failing after 14s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Has been skipped
test / test (push) Has been skipped
ci-cd / deploy (push) Has been skipped
ci / deploy (push) Has been skipped
Some checks failed
audit / audit (push) Has been skipped
ci-cd / build (push) Has been skipped
ci / build (push) Has been skipped
autofix / fix (push) Has been skipped
python-tests / test (push) Failing after 14s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Has been skipped
test / test (push) Has been skipped
ci-cd / deploy (push) Has been skipped
ci / deploy (push) Has been skipped
FINAL IMPORT FIX: Database setup and remaining dependency issues Progress achieved: - Before: collected 0 items / 5 errors - After: collected 61 items / 5 errors (MAJOR IMPROVEMENT!) Remaining issues addressed: 1. Missing 'requests' dependency - added 2. Database file errors - created database directories and files 3. Persistent import issues - added import debugging and path fixes New features: - Database setup: Create mempool.db files in multiple locations - Import debugging: Test specific imports that were failing - Increased maxfail: 10 errors before stopping (from 5) - Better error handling: More comprehensive debugging Database setup: - mkdir -p data/blockchain and apps/blockchain-node/data - touch mempool.db files to prevent sqlite3 errors - Multiple locations to cover different test configurations Import debugging: - Test src.message_protocol import directly - Test aitbc_chain import directly - Add sys.path.insert for problematic imports - Clear success/failure feedback Expected results: - requests import error resolved - Database file errors resolved - Better import resolution for remaining issues - More tests should run successfully - Clear debugging output for troubleshooting This should resolve the final 5 errors and allow more of the 61 collected tests to run successfully.
This commit is contained in:
@@ -93,7 +93,7 @@ jobs:
|
||||
echo "=== ADDITIONAL DEPENDENCIES ==="
|
||||
# Install missing dependencies that cause import errors
|
||||
echo "Installing additional test dependencies..."
|
||||
venv/bin/pip install pydantic-settings sqlmodel sqlalchemy
|
||||
venv/bin/pip install pydantic-settings sqlmodel sqlalchemy requests
|
||||
|
||||
echo "=== PYTHON PATH SETUP ==="
|
||||
# Set up comprehensive Python path for complex import patterns
|
||||
@@ -112,16 +112,47 @@ jobs:
|
||||
echo "Installing pytest with test dependencies..."
|
||||
venv/bin/pip install pytest pytest-cov pytest-mock
|
||||
|
||||
echo "=== RUNNING PYTHON TESTS ==="
|
||||
echo "=== DATABASE SETUP ==="
|
||||
# Create database directories for blockchain-node tests
|
||||
echo "Setting up database directories..."
|
||||
mkdir -p /opt/gitea-runner/workspace/repo/data
|
||||
mkdir -p /opt/gitea-runner/workspace/repo/data/blockchain
|
||||
mkdir -p /opt/gitea-runner/workspace/repo/apps/blockchain-node/data
|
||||
touch /opt/gitea-runner/workspace/repo/data/blockchain/mempool.db
|
||||
touch /opt/gitea-runner/workspace/repo/apps/blockchain-node/data/mempool.db
|
||||
|
||||
echo "=== IMPORT DEBUGGING ==="
|
||||
echo "Python path: $PYTHONPATH"
|
||||
echo "Available modules:"
|
||||
venv/bin/python -c "import sys; print('\\n'.join(sys.path))"
|
||||
|
||||
# Test specific imports that are failing
|
||||
echo "Testing problematic imports..."
|
||||
venv/bin/python -c "
|
||||
try:
|
||||
import sys
|
||||
print('Testing src import...')
|
||||
sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/agent-protocols/src')
|
||||
import message_protocol
|
||||
print('✅ src.message_protocol import successful')
|
||||
except Exception as e:
|
||||
print(f'❌ src import failed: {e}')
|
||||
|
||||
try:
|
||||
print('Testing aitbc import...')
|
||||
sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/blockchain-node/src')
|
||||
import aitbc_chain
|
||||
print('✅ aitbc_chain import successful')
|
||||
except Exception as e:
|
||||
print(f'❌ aitbc import failed: {e}')
|
||||
"
|
||||
|
||||
echo "=== RUNNING PYTHON TESTS ==="
|
||||
echo "Attempting to run tests with comprehensive error handling..."
|
||||
# Try to run tests with maximum error handling
|
||||
venv/bin/python -m pytest \
|
||||
--tb=short \
|
||||
--maxfail=5 \
|
||||
--maxfail=10 \
|
||||
--disable-warnings \
|
||||
-v \
|
||||
|| echo "Tests completed with some import errors (expected in CI)"
|
||||
@@ -178,7 +209,7 @@ jobs:
|
||||
|
||||
python3 -m venv venv && source venv/bin/activate
|
||||
$POETRY_CMD install --no-root
|
||||
venv/bin/pip install pydantic-settings sqlmodel sqlalchemy pytest pytest-cov pytest-mock
|
||||
venv/bin/pip install pydantic-settings sqlmodel sqlalchemy requests pytest pytest-cov pytest-mock
|
||||
|
||||
export PYTHONPATH="/opt/gitea-runner/workspace/repo:$PYTHONPATH"
|
||||
export PYTHONPATH="/opt/gitea-runner/workspace/repo/src:$PYTHONPATH"
|
||||
|
||||
Reference in New Issue
Block a user