mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-07 03:07:24 -04:00
feat: add standardized testing scripts and documentation
Add comprehensive suite of testing scripts for different workflows: - test.sh: Interactive menu for all testing operations - quick_test.sh: Fast unit test feedback (~10-30s) - run_tests.sh: Main test runner with full configuration options - coverage_report.sh: Coverage analysis with HTML/JSON/terminal reports - ci_test.sh: CI/CD optimized testing with JUnit/coverage XML output Features: - Colored terminal output with clear error messages - Consistent option flags across all scripts - Support for test markers (unit, integration, e2e, slow, etc.) - Parallel execution support - Coverage thresholds (default: 85%) - Virtual environment and dependency checks Documentation: - Update CLAUDE.md with testing section and examples - Expand docs/developer/testing.md with comprehensive guide - Add scripts/README.md with quick reference All scripts are tested and executable. This standardizes the testing process for local development, CI/CD, and pull request workflows.
This commit is contained in:
@@ -50,7 +50,7 @@ class TestSimulationWorkerExecution:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return both dates
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16", "2025-01-17"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16", "2025-01-17"], [], {}))
|
||||
|
||||
# Mock ModelDayExecutor
|
||||
with patch("api.simulation_worker.ModelDayExecutor") as mock_executor_class:
|
||||
@@ -82,7 +82,7 @@ class TestSimulationWorkerExecution:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return both dates
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16", "2025-01-17"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16", "2025-01-17"], [], {}))
|
||||
|
||||
execution_order = []
|
||||
|
||||
@@ -127,7 +127,7 @@ class TestSimulationWorkerExecution:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return the date
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], [], {}))
|
||||
|
||||
def create_mock_executor(job_id, date, model_sig, config_path, db_path):
|
||||
"""Create mock executor that simulates job detail status updates."""
|
||||
@@ -168,7 +168,7 @@ class TestSimulationWorkerExecution:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return the date
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], [], {}))
|
||||
|
||||
call_count = 0
|
||||
|
||||
@@ -223,7 +223,7 @@ class TestSimulationWorkerErrorHandling:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return the date
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], [], {}))
|
||||
|
||||
execution_count = 0
|
||||
|
||||
@@ -298,7 +298,7 @@ class TestSimulationWorkerConcurrency:
|
||||
worker = SimulationWorker(job_id=job_id, db_path=clean_db)
|
||||
|
||||
# Mock _prepare_data to return the date
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], []))
|
||||
worker._prepare_data = Mock(return_value=(["2025-01-16"], [], {}))
|
||||
|
||||
with patch("api.simulation_worker.ModelDayExecutor") as mock_executor_class:
|
||||
mock_executor = Mock()
|
||||
@@ -521,7 +521,7 @@ class TestSimulationWorkerHelperMethods:
|
||||
worker.job_manager.get_completed_model_dates = Mock(return_value={})
|
||||
|
||||
# Execute
|
||||
available_dates, warnings = worker._prepare_data(
|
||||
available_dates, warnings, completion_skips = worker._prepare_data(
|
||||
requested_dates=["2025-10-01"],
|
||||
models=["gpt-5"],
|
||||
config_path="config.json"
|
||||
@@ -570,7 +570,7 @@ class TestSimulationWorkerHelperMethods:
|
||||
worker.job_manager.get_completed_model_dates = Mock(return_value={})
|
||||
|
||||
# Execute
|
||||
available_dates, warnings = worker._prepare_data(
|
||||
available_dates, warnings, completion_skips = worker._prepare_data(
|
||||
requested_dates=["2025-10-01"],
|
||||
models=["gpt-5"],
|
||||
config_path="config.json"
|
||||
|
||||
Reference in New Issue
Block a user