From abca9eb899decd68f2f657d6cfa860ccce845dc1 Mon Sep 17 00:00:00 2001 From: TPTBusiness Date: Sat, 9 May 2026 18:06:39 +0200 Subject: [PATCH] fix: add hypothesis to test deps and fix missing imports in deep tests --- requirements/test.txt | 1 + test/backtesting/test_vbt_backtest_deep.py | 3 ++- test/local/test_autopilot.py | 2 ++ test/local/test_continuous_strategies.py | 2 ++ test/local/test_gen_strategies.py | 2 ++ test/local/test_nexquant_parallel.py | 2 ++ test/qlib/test_verify_runtime_deep.py | 3 ++- 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index 4b4fbc0b..da7f56e9 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,3 +1,4 @@ # Requirements for test. coverage +hypothesis pytest diff --git a/test/backtesting/test_vbt_backtest_deep.py b/test/backtesting/test_vbt_backtest_deep.py index 7c4bb562..661e6620 100644 --- a/test/backtesting/test_vbt_backtest_deep.py +++ b/test/backtesting/test_vbt_backtest_deep.py @@ -1,3 +1,4 @@ + """Deep property-based tests for the unified backtest engine. Extends test_vbt_backtest.py with hypothesis-based property tests, @@ -10,8 +11,8 @@ import numpy as np import pandas as pd import pytest -from hypothesis import assume, given, settings from hypothesis import strategies as st +from hypothesis import assume, given, settings from hypothesis.extra.numpy import arrays from rdagent.components.backtesting.vbt_backtest import ( diff --git a/test/local/test_autopilot.py b/test/local/test_autopilot.py index 338933b2..a53afbb1 100644 --- a/test/local/test_autopilot.py +++ b/test/local/test_autopilot.py @@ -5,6 +5,8 @@ the StrategyOrchestrator at the correct import path. """ from __future__ import annotations +from hypothesis import given, settings, HealthCheck +from hypothesis import strategies as st import sys from pathlib import Path diff --git a/test/local/test_continuous_strategies.py b/test/local/test_continuous_strategies.py index 4a912fa6..04103b00 100644 --- a/test/local/test_continuous_strategies.py +++ b/test/local/test_continuous_strategies.py @@ -5,6 +5,8 @@ without requiring real StrategyOrchestrator connections. """ from __future__ import annotations +from hypothesis import given, settings, HealthCheck +from hypothesis import strategies as st import sys from pathlib import Path diff --git a/test/local/test_gen_strategies.py b/test/local/test_gen_strategies.py index cb530677..5ac0c699 100644 --- a/test/local/test_gen_strategies.py +++ b/test/local/test_gen_strategies.py @@ -5,6 +5,8 @@ criteria, and the TeeFile logger — without requiring real OHLCV data or LLM. """ from __future__ import annotations +from hypothesis import given, settings, HealthCheck +from hypothesis import strategies as st import json import os diff --git a/test/local/test_nexquant_parallel.py b/test/local/test_nexquant_parallel.py index a7c8aee3..f625b018 100644 --- a/test/local/test_nexquant_parallel.py +++ b/test/local/test_nexquant_parallel.py @@ -5,6 +5,8 @@ command building, and API key loading logic. """ from __future__ import annotations +from hypothesis import given, settings, HealthCheck +from hypothesis import strategies as st import os import signal diff --git a/test/qlib/test_verify_runtime_deep.py b/test/qlib/test_verify_runtime_deep.py index 0a3dfb8a..610d45dc 100644 --- a/test/qlib/test_verify_runtime_deep.py +++ b/test/qlib/test_verify_runtime_deep.py @@ -1,3 +1,4 @@ + """Deep tests for verify_runtime — property-based, fuzzing, edge cases. Extends test_verify_runtime.py with property-based tests using hypothesis @@ -15,8 +16,8 @@ import pytest PROJECT_ROOT = Path(__file__).parent.parent.parent sys.path.insert(0, str(PROJECT_ROOT)) -from hypothesis import assume, given, settings from hypothesis import strategies as st +from hypothesis import given, settings from hypothesis.extra.numpy import arrays from rdagent.components.backtesting.verify import verify_and_log, verify_backtest_result