Some checks failed
CLI Tests / test-cli (push) Failing after 4s
Deploy to Testnet / deploy-testnet (push) Successful in 1m40s
Documentation Validation / validate-docs (push) Failing after 12s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 2m42s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 34s
Package Tests / Python package - aitbc-core (push) Successful in 27s
Package Tests / Python package - aitbc-crypto (push) Successful in 13s
Package Tests / Python package - aitbc-sdk (push) Successful in 16s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 8s
Package Tests / JavaScript package - aitbc-token (push) Successful in 18s
Python Tests / test-python (push) Failing after 50s
Security Scanning / security-scan (push) Failing after 43s
Multi-Node Stress Testing / stress-test (push) Successful in 12s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
- Created aitbc/_version.py with centralized version definition - Updated aitbc/__init__.py to import __version__ from _version module - Updated constants.py to use __version__ for PACKAGE_VERSION - Replaced print() calls with logger in decorators.py, events.py, queue_manager.py, and state.py - Added logger initialization using get_logger(__name__) in config.py, decorators.py, events.py, queue_manager.py, and state.py - Added cli/commands
113 lines
2.9 KiB
Python
113 lines
2.9 KiB
Python
"""
|
|
Minimal conftest for pytest discovery
|
|
Imports fixtures from dedicated fixture files for better organization
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Configure Python path for test discovery
|
|
project_root = Path(__file__).parent.parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
# Import fixtures from dedicated fixture files
|
|
# Common fixtures (environment setup, data generators)
|
|
from tests.fixtures.common import (
|
|
setup_test_environment,
|
|
mock_optional_dependencies,
|
|
mock_aitbc_crypto,
|
|
sample_tenant,
|
|
sample_job_data,
|
|
mock_db,
|
|
mock_cache,
|
|
test_user_data,
|
|
test_transaction_data,
|
|
test_wallet_data,
|
|
test_ethereum_address,
|
|
)
|
|
|
|
# Coordinator API fixtures
|
|
from tests.fixtures.coordinator import coordinator_client
|
|
|
|
# Blockchain fixtures
|
|
from tests.fixtures.blockchain import (
|
|
blockchain_client,
|
|
wallet_client,
|
|
marketplace_client,
|
|
)
|
|
|
|
# Training fixtures (kept here as they're specific to training tests)
|
|
from aitbc.training_setup import TrainingEnvironment, TrainingSetupError
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def training_env():
|
|
"""
|
|
Session-scoped fixture for training environment setup.
|
|
Sets up the training environment once per test session.
|
|
"""
|
|
env = TrainingEnvironment()
|
|
try:
|
|
env.check_prerequisites()
|
|
yield env
|
|
except TrainingSetupError as e:
|
|
pytest.skip(f"Training prerequisites not met: {e}")
|
|
|
|
|
|
@pytest.fixture
|
|
def training_env_mock():
|
|
"""
|
|
Function-scoped fixture for mocked training environment.
|
|
Uses mocked subprocess calls for faster, isolated tests.
|
|
"""
|
|
from unittest.mock import patch, MagicMock
|
|
|
|
env = TrainingEnvironment()
|
|
|
|
def mock_subprocess_run(*args, **kwargs):
|
|
mock_result = MagicMock()
|
|
mock_result.returncode = 0
|
|
mock_result.stdout = "success"
|
|
mock_result.stderr = ""
|
|
return mock_result
|
|
|
|
with patch('subprocess.run', side_effect=mock_subprocess_run):
|
|
yield env
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_faucet_response():
|
|
"""Mock faucet API response for testing"""
|
|
return {
|
|
"status": "success",
|
|
"address": "ait1testaddress",
|
|
"amount": 1000,
|
|
"transaction_id": "tx_test123",
|
|
"timestamp": "2026-05-05T12:00:00"
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def training_stage_data():
|
|
"""Sample training stage data for testing"""
|
|
return {
|
|
"stage": "stage1_foundation",
|
|
"agent_type": "general",
|
|
"training_data": {
|
|
"prerequisites": {
|
|
"description": "Test prerequisites",
|
|
"setup_script": "/opt/aitbc/scripts/training/setup_training_env.sh",
|
|
"requirements": ["AITBC node running", "Funded accounts"]
|
|
},
|
|
"operations": [
|
|
{
|
|
"operation": "wallet_create",
|
|
"parameters": {"name": "test-wallet"},
|
|
"expected_result": {"status": "success"}
|
|
}
|
|
]
|
|
}
|
|
}
|