Skip to content

Commit 5be0267

Browse files
fix(tests): update order_manager fixture to patch align_price_to_tick_size in both utils and core for determinism
Co-authored-by: Genie <[email protected]>
1 parent c722e27 commit 5be0267

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/order_manager/conftest.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ def order_manager(initialized_client):
1212
Fixture for an OrderManager wired to a mocked ProjectX client.
1313
Also patches align_price_to_tick_size to return the input price for determinism.
1414
"""
15-
# Patch align_price_to_tick_size globally for all tests in this module
16-
patcher = patch(
15+
# Patch align_price_to_tick_size in both utils and core to return input price for determinism
16+
patch_utils = patch(
1717
"project_x_py.order_manager.utils.align_price_to_tick_size",
1818
new=AsyncMock(side_effect=lambda price, *_args, **_kwargs: price),
1919
)
20-
patcher.start()
20+
patch_core = patch(
21+
"project_x_py.order_manager.core.align_price_to_tick_size",
22+
new=AsyncMock(side_effect=lambda price, *_args, **_kwargs: price),
23+
)
24+
patch_utils.start()
25+
patch_core.start()
2126

2227
# Set up a dummy account
2328
initialized_client.account_info = Account(
@@ -32,7 +37,8 @@ def order_manager(initialized_client):
3237
om = OrderManager(initialized_client)
3338
yield om
3439

35-
patcher.stop()
40+
patch_utils.stop()
41+
patch_core.stop()
3642

3743

3844
@pytest.fixture

0 commit comments

Comments
 (0)