From 7af83b5e02af5c2f94261ed712cd361cdc5141f0 Mon Sep 17 00:00:00 2001 From: shuofengzhang Date: Fri, 20 Mar 2026 15:44:30 +0000 Subject: [PATCH] test: skip quoting-engine strategy tests when private module is absent --- tests/test_engine_strategies.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_engine_strategies.py b/tests/test_engine_strategies.py index 64a6279..d5052aa 100644 --- a/tests/test_engine_strategies.py +++ b/tests/test_engine_strategies.py @@ -1,6 +1,7 @@ """Tests for quoting-engine-powered strategies.""" import os import sys +from pathlib import Path import pytest @@ -13,6 +14,16 @@ from sdk.strategy_sdk.base import StrategyContext +_QE_ROOT = Path.home() / "Tee-work-" / "quoting_engine" +requires_quoting_engine = pytest.mark.skipif( + not _QE_ROOT.is_dir(), + reason=( + f"quoting_engine not available at {_QE_ROOT}; " + "skip tests that require private quoting_engine module" + ), +) + + def _snap(mid=2500.0, bid=2499.0, ask=2501.0, funding=0.0001, oi=1e6, ts=1000): spread_bps = round((ask - bid) / mid * 10000, 2) if mid > 0 else 0.0 return MarketSnapshot( @@ -30,6 +41,7 @@ def _ctx(qty=0.0, dd=0.0, reduce_only=False): # EngineMMStrategy # --------------------------------------------------------------------------- +@requires_quoting_engine class TestEngineMM: def test_produces_orders(self): from strategies.engine_mm import EngineMMStrategy @@ -104,6 +116,7 @@ def test_meta_contains_engine_fields(self): # FundingArbStrategy # --------------------------------------------------------------------------- +@requires_quoting_engine class TestFundingArb: def test_produces_orders(self): from strategies.funding_arb import FundingArbStrategy @@ -152,6 +165,7 @@ def test_no_orders_on_zero_mid(self): # RegimeMMStrategy # --------------------------------------------------------------------------- +@requires_quoting_engine class TestRegimeMM: def test_produces_orders(self): from strategies.regime_mm import RegimeMMStrategy @@ -196,6 +210,7 @@ def test_no_orders_on_zero_mid(self): # LiquidationMMStrategy # --------------------------------------------------------------------------- +@requires_quoting_engine class TestLiquidationMM: def test_produces_orders(self): from strategies.liquidation_mm import LiquidationMMStrategy